From cb385f0b515c738b503c5c75c9d7efcec323716d Mon Sep 17 00:00:00 2001
From: duyongjia <adu_555@163.com>
Date: 星期五, 28 二月 2025 09:12:40 +0800
Subject: [PATCH] 数据库脚本提交
---
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs | 803 +++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 751 insertions(+), 52 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
index 423a9af..e735e1a 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
@@ -16,12 +16,15 @@
#endregion << 鐗� 鏈� 娉� 閲� >>
using AutoMapper;
+using Newtonsoft.Json;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
using SqlSugar;
using SqlSugar.Extensions;
using System;
+using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
+using System.Data;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Reflection;
@@ -40,6 +43,7 @@
using WIDESEAWCS_ITaskInfoRepository;
using WIDESEAWCS_ITaskInfoService;
using WIDESEAWCS_Model.Models;
+using WIDESEAWCS_QuartzJob;
using WIDESEAWCS_QuartzJob.Models;
using WIDESEAWCS_QuartzJob.Service;
@@ -53,6 +57,7 @@
private readonly ILocationInfoRepository _locationInfoRepository;
private readonly IMapper _mapper;
private readonly IUnitOfWorkManage _unitOfWorkManage;
+ private readonly ITaskRepository _taskRepository;
private Dictionary<string, OrderByType> _taskOrderBy = new()
{
@@ -70,7 +75,7 @@
public List<int> TaskOtherboundTypes => typeof(TaskOtherTypeEnum).GetEnumIndexList();
- public TaskService(ITaskRepository BaseDal, IRouterService routerService, ITaskExecuteDetailService taskExecuteDetailService, ITaskExecuteDetailRepository taskExecuteDetailRepository, IMapper mapper, ILocationInfoRepository locationInfoRepository, IUnitOfWorkManage unitOfWorkManage) : base(BaseDal)
+ public TaskService(ITaskRepository BaseDal, IRouterService routerService, ITaskExecuteDetailService taskExecuteDetailService, ITaskExecuteDetailRepository taskExecuteDetailRepository, IMapper mapper, ILocationInfoRepository locationInfoRepository, IUnitOfWorkManage unitOfWorkManage, ITaskRepository taskRepository) : base(BaseDal)
{
_routerService = routerService;
_taskExecuteDetailService = taskExecuteDetailService;
@@ -78,6 +83,7 @@
_mapper = mapper;
_locationInfoRepository = locationInfoRepository;
_unitOfWorkManage = unitOfWorkManage;
+ _taskRepository = taskRepository;
}
/// <summary>
@@ -147,7 +153,9 @@
WebResponseContent content = new WebResponseContent();
try
{
- // ServiceLogger.WriteLogToFile("");
+ string inparam = JsonConvert.SerializeObject(taskDTO);
+
+ ServiceLogger.WriteDebug("ReceiveTask", $"ReceiveMESTask鏂规硶鍏ュ弬{inparam}");
Dt_Task task = new Dt_Task();
Dt_Task taskinfo = BaseDal.QueryFirst(x => x.TaskNum == taskDTO.task_id);
if(taskDTO.cmd==101)//濡傛灉鏄�101鎸夋棫鐨勪换鍔″彿鍘绘煡
@@ -157,6 +165,7 @@
if (taskDTO.cmd!=3001&& taskDTO.cmd != 101 && taskinfo != null)
{
+ ServiceLogger.WriteDebug("ReceiveTask", $"浠诲姟鍙烽噸澶嶏紝浠诲姟鍙凤細{taskDTO.task_id}");
return content = WebResponseContent.Instance.Error($"浠诲姟鍙烽噸澶嶏紝浠诲姟鍙凤細{taskDTO.task_id}");
}
Dt_LocationInfo locationsrc = _locationInfoRepository.QueryFirst(x => x.Remark == taskDTO.src_station.ToString());
@@ -175,10 +184,11 @@
}
else
{
+ ServiceLogger.WriteDebug("ReceiveTask", $"WCS鏈煡璇㈠埌婧愮珯鐐瑰搴旂殑搴撲綅锛屾簮绔欑偣锛歿taskDTO.dest_station.ToString()}");
return content = WebResponseContent.Instance.Error($"WCS鏈煡璇㈠埌婧愮珯鐐瑰搴旂殑搴撲綅锛屾簮绔欑偣锛歿taskDTO.dest_station.ToString()}");
}
break;
- case 3001://AGV鏀捐揣瀹屾垚 WMS鍙�3001鐨勫悓鏃朵細鍐欐彁鍗囦俊鍙�
+ case 3001://AGV鏀捐揣瀹屾垚 WMS鍙�3001鐨勫悓鏃禬CS闇�鍦╦ob涓啓鎻愬崌淇″彿
if (BaseDal.QueryFirst(x => x.TaskNum == taskDTO.task_id) == null)//鎵嬪姩鍏ュ簱鐩存帴鍙�3001锛岄渶瑕佺敓鎴愪换鍔★紝鍥犱负娌℃湁1001鐜妭
{
@@ -193,6 +203,7 @@
}
else
{
+ ServiceLogger.WriteDebug("ReceiveTask", $"WCS鏈煡璇㈠埌婧愮珯鐐瑰搴旂殑搴撲綅锛屾簮绔欑偣锛歿taskDTO.dest_station.ToString()}");
return content = WebResponseContent.Instance.Error($"WCS鏈煡璇㈠埌婧愮珯鐐瑰搴旂殑搴撲綅锛屾簮绔欑偣锛歿taskDTO.dest_station.ToString()}");
}
}
@@ -201,7 +212,8 @@
if (taskinfo != null)
{
UpdateTaskStatus(taskinfo.TaskId, (int)TaskInStatusEnum.AGV_InExecuting);
- _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"AGV鍏ュ簱鎵ц涓�");
+ _taskExecuteDetailService.AddTaskExecuteDetail(taskinfo.TaskId, $"AGV鍏ュ簱鎵ц涓�");
+ ServiceLogger.WriteDebug("ReceiveTask", $"AGV鍏ュ簱鎵ц涓紙鑷姩3001锛夋洿鏂扮姸鎬佹垚鍔燂紝浠诲姟鍙凤細{taskinfo.TaskId}");
return content = WebResponseContent.Instance.OK($"AGV鍏ュ簱鎵ц涓紙鑷姩3001锛夋洿鏂扮姸鎬佹垚鍔燂紝浠诲姟鍙凤細{taskinfo.TaskId}");
}
else
@@ -216,11 +228,13 @@
{
//鏇存柊浠诲姟琛ㄤ腑NextAddress瀛楁涓烘柊鐨勪换鍔″彿 taskDTO.weight-鏃х殑浠诲姟鍙� taskDTO.task_id-鏂扮殑浠诲姟鍙�
UpdateTaskStatus(taskinfo.TaskId, taskDTO.task_id, (int)TaskInStatusEnum.AGV_InFinish);
- _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"AGV鎼繍瀹屾垚");
+ _taskExecuteDetailService.AddTaskExecuteDetail(taskinfo.TaskId, $"AGV鎼繍瀹屾垚");
+ ServiceLogger.WriteDebug("ReceiveTask", $"AGV鎼繍瀹屾垚锛�101锛夋洿鏂扮姸鎬佹垚鍔燂紝浠诲姟鍙凤細{taskinfo.TaskId}");
return content = WebResponseContent.Instance.OK($"AGV鎼繍瀹屾垚锛�101锛夋洿鏂扮姸鎬佹垚鍔燂紝浠诲姟鍙凤細{taskinfo.TaskId}");
}
else
{
+ ServiceLogger.WriteDebug("ReceiveTask", $"AGV鎼繍瀹屾垚锛�101锛夋洿鏂扮姸鎬佹椂锛屾煡璇笉鍒颁换鍔″彿");
return content = WebResponseContent.Instance.Error($"AGV鎼繍瀹屾垚锛�101锛夋洿鏂扮姸鎬佹椂锛屾煡璇笉鍒颁换鍔″彿");
}
break;
@@ -229,6 +243,10 @@
task.TaskType= (int)TaskRelocationTypeEnum.Relocation;
task.TaskState = (int)TaskOutStatusEnum.OutNew;
task.Roadway = "SC01";
+ if (taskDTO.total > 0)
+ {
+ task.Remark = taskDTO.total.ToString();//鍙栧嚭搴撶殑鎬诲眰鏁�
+ }
task.Grade = 1;
break;
case 102:
@@ -252,7 +270,8 @@
}
else
{
- return content = WebResponseContent.Instance.Error($"WCS鏈煡璇㈠埌鐩爣绔欑偣瀵瑰簲鐨勫簱浣嶏紝鐩爣绔欑偣锛歿taskDTO.dest_station.ToString()}");
+ ServiceLogger.WriteDebug("ReceiveTask", $"WCS鏈煡璇㈠埌鐩爣绔欑偣瀵瑰簲鐨勫簱浣嶏紝鐩爣绔欑偣锛歿taskDTO.dest_station.ToString()}");
+ return content = WebResponseContent.Instance.Error($"WCS鏈煡璇㈠埌鐩爣绔欑偣瀵瑰簲鐨勫簱浣嶏紝鐩爣绔欑偣锛歿taskDTO.dest_station.ToString()}");
}
break;
case 104://缁勭珛鏈轰笂鏂� 鏆傚瓨浣�-->缁勭珛鏈�
@@ -270,7 +289,8 @@
}
else
{
- return content = WebResponseContent.Instance.Error($"WCS鏈煡璇㈠埌鐩爣绔欑偣瀵瑰簲鐨勫簱浣嶏紝鐩爣绔欑偣锛歿task.TargetAddress.ToString()}");
+ ServiceLogger.WriteDebug("ReceiveTask", $"WCS鏈煡璇㈠埌鐩爣绔欑偣瀵瑰簲鐨勫簱浣嶏紝鐩爣绔欑偣锛歿task.TargetAddress.ToString()}");
+ return content = WebResponseContent.Instance.Error($"WCS鏈煡璇㈠埌鐩爣绔欑偣瀵瑰簲鐨勫簱浣嶏紝鐩爣绔欑偣锛歿task.TargetAddress.ToString()}");
}
//鏍规嵁鐩爣鍦板潃锛堢粍绔嬫満锛夋煡璇㈤粯璁ょ殑鎵ц浠诲姟鐨勫皬鍫嗗灈鏈虹紪鍙�
Dt_LocationInfo locationtemp2 = _locationInfoRepository.QueryFirst(x => x.LocationCode == task.TargetAddress.ToString());
@@ -280,6 +300,8 @@
}
else
{
+
+ ServiceLogger.WriteDebug("ReceiveTask", $"WCS鏈煡璇㈠埌缁勭珛鏈哄搴旂殑榛樿灏忓爢鍨涙満閰嶇疆");
return content = WebResponseContent.Instance.Error($"WCS鏈煡璇㈠埌缁勭珛鏈哄搴旂殑榛樿灏忓爢鍨涙満閰嶇疆");
}
@@ -292,7 +314,7 @@
task.TaskNum = taskDTO.task_id;
task.PalletCode = taskDTO.CarId;
- task.Roadway = "SC01";
+
if (string.IsNullOrEmpty(task.SourceAddress))//濡傛灉涓嶆槸绔欑偣锛岀洿鎺ュ彇琛屽垪灞�
{
task.SourceAddress = $"SC01-{taskDTO.src_rack.ToString().PadLeft(3, '0')}-{taskDTO.src_col.ToString().PadLeft(3, '0')}-{taskDTO.src_row.ToString().PadLeft(3, '0')}";
@@ -310,10 +332,12 @@
{
if (srcLocation.EnableStatus == (int)EnableStatusEnum.Disable)
{
+ ServiceLogger.WriteDebug("ReceiveTask", $"婧愬湴鍧�宸茬鐢細{srcLocation.LocationCode}");
return content = WebResponseContent.Instance.Error($"婧愬湴鍧�宸茬鐢細{srcLocation.LocationCode}");
}
if (tarLocation.EnableStatus == (int)EnableStatusEnum.Disable)
{
+ ServiceLogger.WriteDebug("ReceiveTask", $"鐩爣鍦板潃宸茬鐢細{tarLocation.LocationCode}");
return content = WebResponseContent.Instance.Error($"鐩爣鍦板潃宸茬鐢細{tarLocation.LocationCode}");
}
if (taskDTO.cmd != 101)//鍏ュ簱鏃朵笉闇�瑕佸垽鏂槸鍚﹂攣瀹氾紝閿佸畾鐘舵�佹槸鍦ㄧ敓鎴愪换鍔℃椂閿佸畾
@@ -323,10 +347,13 @@
{
if (srcLocation.LocationStatus == (int)LocationStatusEnum.Lock)
{
+
+ ServiceLogger.WriteDebug("ReceiveTask", $"婧愬湴鍧�宸查攣瀹氾細{srcLocation.LocationCode}");
return content = WebResponseContent.Instance.Error($"婧愬湴鍧�宸查攣瀹氾細{srcLocation.LocationCode}");
}
if (tarLocation.LocationStatus == (int)LocationStatusEnum.Lock)
{
+ ServiceLogger.WriteDebug("ReceiveTask", $"鐩爣鍦板潃宸查攣瀹氾細{tarLocation.LocationCode}");
return content = WebResponseContent.Instance.Error($"鐩爣鍦板潃宸查攣瀹氾細{tarLocation.LocationCode}");
}
}
@@ -336,6 +363,8 @@
//WCS鏌ヨ搴撲綅鐘舵�佹槸鍚︿负鈥滅┖闂测�濆苟涓旀湭绂佺敤锛岄攣瀹氬簱浣嶄慨鏀瑰簱浣嶇姸鎬佷负鈥滈攣瀹氣�濓紝鐢熸垚WCS浜у搧鍏ュ簱浠诲姟锛屽姞鍏CS浠诲姟闃熷垪涓��
if (tarLocation.LocationStatus != (int)LocationStatusEnum.Free)
{
+
+ ServiceLogger.WriteDebug("ReceiveTask", $"鍏ュ簱-鐩爣鍦板潃涓嶆槸绌洪棽鐘舵�侊細{tarLocation.LocationCode}");
return content = WebResponseContent.Instance.Error($"鍏ュ簱-鐩爣鍦板潃涓嶆槸绌洪棽鐘舵�侊細{tarLocation.LocationCode}");
}
//srcLocation.LocationStatus = (int)LocationStatusEnum.Lock;
@@ -354,10 +383,14 @@
//WCS鏌ヨ搴撲綅鐘舵�佹槸鍚︿负鈥滄湁璐р�濓紝搴撲綅/鏆傚瓨搴撲綅鏄惁鈥滅┖闂测��
if (srcLocation.LocationStatus != (int)LocationStatusEnum.InStock)
{
+
+ ServiceLogger.WriteDebug("ReceiveTask", $"绉诲簱-婧愬湴鍧�涓嶆槸鏈夎揣鐘舵�侊細{srcLocation.LocationCode}");
return content = WebResponseContent.Instance.Error($"绉诲簱-婧愬湴鍧�涓嶆槸鏈夎揣鐘舵�侊細{srcLocation.LocationCode}");
}
if(tarLocation.LocationStatus != (int)LocationStatusEnum.Free)
{
+
+ ServiceLogger.WriteDebug("ReceiveTask", $"绉诲簱-鐩爣鍦板潃涓嶆槸绌洪棽鐘舵�侊細{srcLocation.LocationCode}");
return content = WebResponseContent.Instance.Error($"绉诲簱-鐩爣鍦板潃涓嶆槸绌洪棽鐘舵�侊細{srcLocation.LocationCode}");
}
srcLocation.LocationStatus = (int)LocationStatusEnum.Lock;
@@ -369,6 +402,8 @@
//WCS鏌ヨ搴撲綅鐘舵�佹槸鍚︿负鈥滄湁璐р��
if (srcLocation.LocationStatus != (int)LocationStatusEnum.InStock)
{
+
+ ServiceLogger.WriteDebug("ReceiveTask", $"寮傚父鍑哄簱-婧愬湴鍧�涓嶆槸鏈夎揣鐘舵�侊細{srcLocation.LocationCode}");
return content = WebResponseContent.Instance.Error($"寮傚父鍑哄簱-婧愬湴鍧�涓嶆槸鏈夎揣鐘舵�侊細{srcLocation.LocationCode}");
}
srcLocation.LocationStatus = (int)LocationStatusEnum.Lock;
@@ -384,6 +419,8 @@
//WCS鏌ヨ鏆傚瓨搴撲綅鏄惁鈥滄湁璐р��
if (srcLocation.LocationStatus != (int)LocationStatusEnum.InStock)
{
+
+ ServiceLogger.WriteDebug("ReceiveTask", $"绌鸿溅鍑哄簱-婧愬湴鍧�涓嶆槸鏈夎揣鐘舵�侊細{srcLocation.LocationCode}");
return content = WebResponseContent.Instance.Error($"绌鸿溅鍑哄簱-婧愬湴鍧�涓嶆槸鏈夎揣鐘舵�侊細{srcLocation.LocationCode}");
}
//srcLocation.LocationStatus = (int)LocationStatusEnum.Lock;
@@ -398,6 +435,8 @@
//WCS鏌ヨ鏆傚瓨搴撲綅鏄惁鈥滄湁璐р��
if (srcLocation.LocationStatus != (int)LocationStatusEnum.InStock)
{
+
+ ServiceLogger.WriteDebug("ReceiveTask", $"涓婃枡浠诲姟-婧愬湴鍧�涓嶆槸鏈夎揣鐘舵�侊細{srcLocation.LocationCode}");
return content = WebResponseContent.Instance.Error($"涓婃枡浠诲姟-婧愬湴鍧�涓嶆槸鏈夎揣鐘舵�侊細{srcLocation.LocationCode}");
}
//srcLocation.LocationStatus = (int)LocationStatusEnum.Lock;
@@ -408,6 +447,7 @@
}
else
{
+ ServiceLogger.WriteDebug("ReceiveTask", $"搴撲綅鍦板潃涓嶅瓨鍦紝浠诲姟鍙�:{task.TaskNum}");
return content = WebResponseContent.Instance.Error($"搴撲綅鍦板潃涓嶅瓨鍦紝浠诲姟鍙�:{task.TaskNum}");
}
@@ -431,16 +471,264 @@
_unitOfWorkManage.RollbackTran();
throw;
}
-
- content = WebResponseContent.Instance.OK("鎴愬姛",task);
+ ServiceLogger.WriteDebug("ReceiveTask", $"鎺ユ敹浠诲姟鎴愬姛锛屼换鍔″彿:{task.TaskNum}");
+ content = WebResponseContent.Instance.OK($"鎺ユ敹浠诲姟鎴愬姛锛屼换鍔″彿:{task.TaskNum}", task);
}
catch (Exception ex)
{
+ ServiceLogger.WriteDebug("ReceiveTask", $"浠诲姟鎺ユ敹閿欒,閿欒淇℃伅:{ex.StackTrace}");
content = WebResponseContent.Instance.Error($"浠诲姟鎺ユ敹閿欒,閿欒淇℃伅:{ex.Message}");
}
return content;
+ }
+
+
+ /// <summary>
+ /// wcs鎵嬪伐鐢熸垚浠诲姟
+ /// </summary>
+ /// <param name="taskDTO">WCS浠诲姟瀵硅薄</param>
+ /// <returns>杩斿洖澶勭悊缁撴灉</returns>
+ public WebResponseContent ReceiveWCSTask([NotNull] MESTaskDTO taskDTO)
+ {
+ WebResponseContent content = new WebResponseContent();
+ try
+ {
+ taskDTO.task_id = GetTaskNo();
+ string inparam = JsonConvert.SerializeObject(taskDTO);
+
+ ServiceLogger.WriteDebug("ReceiveWCSTask", $"ReceiveWCSTask鏂规硶鍏ュ弬{inparam}");
+ Dt_Task task = new Dt_Task();
+ Dt_Task taskinfo = BaseDal.QueryFirst(x => x.TaskNum == taskDTO.task_id);
+ if (taskDTO.cmd == 101)//濡傛灉鏄�101鎸夋棫鐨勪换鍔″彿鍘绘煡
+ {
+ taskinfo = BaseDal.QueryFirst(x => x.TaskNum == taskDTO.weight);
+ }
+
+ if (taskDTO.cmd != 3001 && taskDTO.cmd != 101 && taskinfo != null)
+ {
+ ServiceLogger.WriteDebug("ReceiveWCSTask", $"浠诲姟鍙烽噸澶嶏紝浠诲姟鍙凤細{taskDTO.task_id}");
+ return content = WebResponseContent.Instance.Error($"浠诲姟鍙烽噸澶嶏紝浠诲姟鍙凤細{taskDTO.task_id}");
+ }
+ Dt_LocationInfo locationsrc = _locationInfoRepository.QueryFirst(x => x.Remark == taskDTO.src_station.ToString());
+ Dt_LocationInfo locationdsc = _locationInfoRepository.QueryFirst(x => x.Remark == taskDTO.dest_station.ToString());
+ switch (taskDTO.cmd)
+ {
+ case 3001://AGV鏀捐揣瀹屾垚 WMS鍙�3001鐨勫悓鏃禬CS闇�鍦╦ob涓啓鎻愬崌淇″彿
+ if (BaseDal.QueryFirst(x => x.TaskNum == taskDTO.task_id) == null)//鎵嬪姩鍏ュ簱鐩存帴鍙�3001锛岄渶瑕佺敓鎴愪换鍔★紝鍥犱负娌℃湁1001鐜妭
+ {
+ taskDTO.dest_rack =int.Parse(taskDTO.dest_station.ToString().Substring(0, 1));
+ taskDTO.dest_row = int.Parse(taskDTO.dest_station.ToString().Substring(1, 2).TrimStart('0'));
+ taskDTO.dest_col = int.Parse(taskDTO.dest_station.ToString().Substring(3, 2).TrimStart('0'));
+ task.TaskType = (int)TaskInboundTypeEnum.Inbound;
+ task.TaskState = (int)TaskInStatusEnum.AGV_InExecuting;
+ task.Roadway = "SC01";
+ task.Grade = 2;
+
+ if (locationsrc != null)
+ {
+ task.SourceAddress = locationsrc.LocationCode;
+ }
+ else
+ {
+ ServiceLogger.WriteDebug("ReceiveWCSTask", $"WCS鏈煡璇㈠埌婧愮珯鐐瑰搴旂殑搴撲綅锛屾簮绔欑偣锛歿taskDTO.dest_station.ToString()}");
+ return content = WebResponseContent.Instance.Error($"WCS鏈煡璇㈠埌婧愮珯鐐瑰搴旂殑搴撲綅锛屾簮绔欑偣锛歿taskDTO.dest_station.ToString()}");
+ }
+ }
+ break;
+ case 101://鎻愬崌鏈烘彁鍗囧畬鎴�
+ if (taskinfo != null)
+ {
+ //鏇存柊浠诲姟琛ㄤ腑NextAddress瀛楁涓烘柊鐨勪换鍔″彿 taskDTO.weight-鏃х殑浠诲姟鍙� taskDTO.task_id-鏂扮殑浠诲姟鍙�
+ UpdateTaskStatus(taskinfo.TaskId, taskDTO.task_id, (int)TaskInStatusEnum.AGV_InFinish);
+ _taskExecuteDetailService.AddTaskExecuteDetail(taskinfo.TaskId, $"AGV鎼繍瀹屾垚");
+ ServiceLogger.WriteDebug("ReceiveWCSTask", $"AGV鎼繍瀹屾垚锛�101锛夋洿鏂扮姸鎬佹垚鍔燂紝浠诲姟鍙凤細{taskinfo.TaskId}");
+ return content = WebResponseContent.Instance.OK($"AGV鎼繍瀹屾垚锛�101锛夋洿鏂扮姸鎬佹垚鍔燂紝浠诲姟鍙凤細{taskinfo.TaskId}");
+ }
+ else
+ {
+ ServiceLogger.WriteDebug("ReceiveWCSTask", $"AGV鎼繍瀹屾垚锛�101锛夋洿鏂扮姸鎬佹椂锛屾煡璇笉鍒颁换鍔″彿");
+ return content = WebResponseContent.Instance.Error($"AGV鎼繍瀹屾垚锛�101锛夋洿鏂扮姸鎬佹椂锛屾煡璇笉鍒颁换鍔″彿");
+ }
+ break;
+
+ case 103://浜у搧绉诲簱锛堢Щ搴擄紝鍑哄簱锛�
+ taskDTO.src_rack = int.Parse(taskDTO.src_station.ToString().Substring(0, 1));
+ taskDTO.src_row = int.Parse(taskDTO.src_station.ToString().Substring(1, 2).TrimStart('0'));
+ taskDTO.src_col = int.Parse(taskDTO.src_station.ToString().Substring(3, 2).TrimStart('0'));
+
+ taskDTO.dest_rack = int.Parse(taskDTO.dest_station.ToString().Substring(0, 1));
+ taskDTO.dest_row = int.Parse(taskDTO.dest_station.ToString().Substring(1, 2).TrimStart('0'));
+ taskDTO.dest_col = int.Parse(taskDTO.dest_station.ToString().Substring(3, 2).TrimStart('0'));
+
+ taskDTO.total = 9;
+ task.TaskType = (int)TaskRelocationTypeEnum.Relocation;
+ task.TaskState = (int)TaskOutStatusEnum.OutNew;
+ task.Roadway = "SC01";
+
+ if (taskDTO.total > 0)
+ {
+ task.Remark = taskDTO.total.ToString();//鍙栧嚭搴撶殑鎬诲眰鏁�
+ }
+ task.Grade = 1;
+ break;
+ case 102:
+ if (taskDTO.dest_station == 1001 || taskDTO.dest_station == 1002)//寮傚父鍑哄簱
+ {
+ taskDTO.src_rack = int.Parse(taskDTO.src_station.ToString().Substring(0, 1));
+ taskDTO.src_row = int.Parse(taskDTO.src_station.ToString().Substring(1, 2).TrimStart('0'));
+ taskDTO.src_col = int.Parse(taskDTO.src_station.ToString().Substring(3, 2).TrimStart('0'));
+ task.TaskType = (int)TaskOutboundTypeEnum.OutInventory;
+ task.TaskState = (int)TaskOutStatusEnum.OutNew;
+ task.Roadway = "SC01";
+ task.Grade = 1;
+ }
+ if (locationdsc != null)
+ {
+ task.TargetAddress = locationdsc.LocationCode;
+ }
+ else
+ {
+ ServiceLogger.WriteDebug("ReceiveWCSTask", $"WCS鏈煡璇㈠埌鐩爣绔欑偣瀵瑰簲鐨勫簱浣嶏紝鐩爣绔欑偣锛歿taskDTO.dest_station.ToString()}");
+ return content = WebResponseContent.Instance.Error($"WCS鏈煡璇㈠埌鐩爣绔欑偣瀵瑰簲鐨勫簱浣嶏紝鐩爣绔欑偣锛歿taskDTO.dest_station.ToString()}");
+ }
+ break;
+ default:
+ break;
+ }
+
+ task.TaskNum = taskDTO.task_id;
+ task.PalletCode = taskDTO.CarId;
+
+ if (string.IsNullOrEmpty(task.SourceAddress))//濡傛灉涓嶆槸绔欑偣锛岀洿鎺ュ彇琛屽垪灞�
+ {
+ task.SourceAddress = $"SC01-{taskDTO.src_rack.ToString().PadLeft(3, '0')}-{taskDTO.src_col.ToString().PadLeft(3, '0')}-{taskDTO.src_row.ToString().PadLeft(3, '0')}";
+ }
+ if (string.IsNullOrEmpty(task.TargetAddress))//濡傛灉涓嶆槸绔欑偣锛岀洿鎺ュ彇琛屽垪灞�
+ {
+ task.TargetAddress = $"SC01-{taskDTO.dest_rack.ToString().PadLeft(3, '0')}-{taskDTO.dest_col.ToString().PadLeft(3, '0')}-{taskDTO.dest_row.ToString().PadLeft(3, '0')}";
+ }
+ task.Creater = "WCS";
+ task.WMSId = 3;//WCS浜哄伐寤轰换鍔�
+
+ //鍒ゆ柇璐т綅鐘舵��
+ Dt_LocationInfo srcLocation = _locationInfoRepository.QueryFirst(x => x.LocationCode == task.SourceAddress);
+ Dt_LocationInfo tarLocation = _locationInfoRepository.QueryFirst(x => x.LocationCode == task.TargetAddress);
+ if (srcLocation != null && tarLocation != null)
+ {
+ if (srcLocation.EnableStatus == (int)EnableStatusEnum.Disable)
+ {
+ ServiceLogger.WriteDebug("ReceiveWCSTask", $"婧愬湴鍧�宸茬鐢細{srcLocation.LocationCode}");
+ return content = WebResponseContent.Instance.Error($"婧愬湴鍧�宸茬鐢細{srcLocation.LocationCode}");
+ }
+ if (tarLocation.EnableStatus == (int)EnableStatusEnum.Disable)
+ {
+ ServiceLogger.WriteDebug("ReceiveWCSTask", $"鐩爣鍦板潃宸茬鐢細{tarLocation.LocationCode}");
+ return content = WebResponseContent.Instance.Error($"鐩爣鍦板潃宸茬鐢細{tarLocation.LocationCode}");
+ }
+ if (taskDTO.cmd != 101)//鍏ュ簱鏃朵笉闇�瑕佸垽鏂槸鍚﹂攣瀹氾紝閿佸畾鐘舵�佹槸鍦ㄧ敓鎴愪换鍔℃椂閿佸畾
+ {
+
+ if (taskinfo != null && taskDTO.cmd == 3001 && taskinfo.WMSId == 3)//濡傛灉鏄墜鍔ㄥ叆搴擄紝鍙�3001锛屼細鐢熸垚浠诲姟锛岄渶瑕佸垽鏂簱浣嶆槸鍚﹂攣瀹�;鑷姩妯″紡鍙�1001鐨勬椂鍊欏氨鐢熸垚浜嗕换鍔★紝鍐嶅彂3001灏变笉闇�瑕佸垽鏂槸鍚﹂攣瀹氫簡
+ {
+ if (srcLocation.LocationStatus == (int)LocationStatusEnum.Lock)
+ {
+
+ ServiceLogger.WriteDebug("ReceiveWCSTask", $"婧愬湴鍧�宸查攣瀹氾細{srcLocation.LocationCode}");
+ return content = WebResponseContent.Instance.Error($"婧愬湴鍧�宸查攣瀹氾細{srcLocation.LocationCode}");
+ }
+ if (tarLocation.LocationStatus == (int)LocationStatusEnum.Lock)
+ {
+ ServiceLogger.WriteDebug("ReceiveWCSTask", $"鐩爣鍦板潃宸查攣瀹氾細{tarLocation.LocationCode}");
+ return content = WebResponseContent.Instance.Error($"鐩爣鍦板潃宸查攣瀹氾細{tarLocation.LocationCode}");
+ }
+ }
+ }
+ if (task.TaskType == (int)TaskInboundTypeEnum.Inbound)//鍏ュ簱 璺緞锛氭彁鍗囨満搴撲綅-->搴撲綅
+ {
+ //WCS鏌ヨ搴撲綅鐘舵�佹槸鍚︿负鈥滅┖闂测�濆苟涓旀湭绂佺敤锛岄攣瀹氬簱浣嶄慨鏀瑰簱浣嶇姸鎬佷负鈥滈攣瀹氣�濓紝鐢熸垚WCS浜у搧鍏ュ簱浠诲姟锛屽姞鍏CS浠诲姟闃熷垪涓��
+ if (tarLocation.LocationStatus != (int)LocationStatusEnum.Free)
+ {
+
+ ServiceLogger.WriteDebug("ReceiveWCSTask", $"鍏ュ簱-鐩爣鍦板潃涓嶆槸绌洪棽鐘舵�侊細{tarLocation.LocationCode}");
+ return content = WebResponseContent.Instance.Error($"鍏ュ簱-鐩爣鍦板潃涓嶆槸绌洪棽鐘舵�侊細{tarLocation.LocationCode}");
+ }
+ tarLocation.LocationStatus = (int)LocationStatusEnum.Lock;
+ }
+ else if (task.TaskType == (int)TaskRelocationTypeEnum.Relocation) //浜у搧绉诲簱锛堢Щ搴擄紝鍑哄簱鍏辩敤锛� 璺緞锛氬簱浣�-->搴撲綅/鏆傚瓨搴撲綅
+ {
+ //WCS鏌ヨ搴撲綅鐘舵�佹槸鍚︿负鈥滄湁璐р�濓紝搴撲綅/鏆傚瓨搴撲綅鏄惁鈥滅┖闂测��
+ if (srcLocation.LocationStatus != (int)LocationStatusEnum.InStock)
+ {
+ ServiceLogger.WriteDebug("ReceiveWCSTask", $"绉诲簱-婧愬湴鍧�涓嶆槸鏈夎揣鐘舵�侊細{srcLocation.LocationCode}");
+ return content = WebResponseContent.Instance.Error($"绉诲簱-婧愬湴鍧�涓嶆槸鏈夎揣鐘舵�侊細{srcLocation.LocationCode}");
+ }
+ if (tarLocation.LocationStatus != (int)LocationStatusEnum.Free)
+ {
+
+ ServiceLogger.WriteDebug("ReceiveWCSTask", $"绉诲簱-鐩爣鍦板潃涓嶆槸绌洪棽鐘舵�侊細{srcLocation.LocationCode}");
+ return content = WebResponseContent.Instance.Error($"绉诲簱-鐩爣鍦板潃涓嶆槸绌洪棽鐘舵�侊細{srcLocation.LocationCode}");
+ }
+ srcLocation.LocationStatus = (int)LocationStatusEnum.Lock;
+ tarLocation.LocationStatus = (int)LocationStatusEnum.Lock;
+ }
+ else if (task.TaskType == (int)TaskOutboundTypeEnum.OutInventory) //寮傚父鍑哄簱锛堥��搴擄級 璺緞锛氬簱浣�-->鎻愬崌鏈哄簱浣�
+ {
+ //WCS鏌ヨ搴撲綅鐘舵�佹槸鍚︿负鈥滄湁璐р��
+ if (srcLocation.LocationStatus != (int)LocationStatusEnum.InStock)
+ {
+ ServiceLogger.WriteDebug("ReceiveWCSTask", $"寮傚父鍑哄簱-婧愬湴鍧�涓嶆槸鏈夎揣鐘舵�侊細{srcLocation.LocationCode}");
+ return content = WebResponseContent.Instance.Error($"寮傚父鍑哄簱-婧愬湴鍧�涓嶆槸鏈夎揣鐘舵�侊細{srcLocation.LocationCode}");
+ }
+ srcLocation.LocationStatus = (int)LocationStatusEnum.Lock;
+ }
+ }
+ else
+ {
+ ServiceLogger.WriteDebug("ReceiveWCSTask", $"搴撲綅鍦板潃涓嶅瓨鍦紝浠诲姟鍙�:{task.TaskNum}");
+ return content = WebResponseContent.Instance.Error($"搴撲綅鍦板潃涓嶅瓨鍦紝浠诲姟鍙�:{task.TaskNum}");
+ }
+
+ try
+ {
+ //寮�鍚簨鐗�
+ _unitOfWorkManage.BeginTran();
+ _locationInfoRepository.UpdateData(tarLocation);
+ _locationInfoRepository.UpdateData(srcLocation);
+ BaseDal.AddData(task);
+ Dt_Task tasktemp = BaseDal.QueryFirst(x => x.TaskNum == task.TaskNum);
+ _taskExecuteDetailService.AddTaskExecuteDetail(tasktemp.TaskId, "鎺ユ敹WCS浠诲姟");
+ //鎻愪氦浜嬪姟
+ _unitOfWorkManage.CommitTran();
+
+ }
+ catch (Exception)
+ {
+ _unitOfWorkManage.RollbackTran();
+ throw;
+ }
+ ServiceLogger.WriteDebug("ReceiveWCSTask", $"鎺ユ敹浠诲姟鎴愬姛锛屼换鍔″彿:{task.TaskNum}");
+ content = WebResponseContent.Instance.OK($"鎺ユ敹浠诲姟鎴愬姛锛屼换鍔″彿:{task.TaskNum}", task);
+
+ }
+ catch (Exception ex)
+ {
+ ServiceLogger.WriteDebug("ReceiveWCSTask", $"浠诲姟鎺ユ敹閿欒,閿欒淇℃伅:{ex.StackTrace}");
+ content = WebResponseContent.Instance.Error($"浠诲姟鎺ユ敹閿欒,閿欒淇℃伅:{ex.Message}");
+ }
+ return content;
+ }
+
+
+ /// <summary>
+ /// 鑾峰彇浠诲姟鍙�
+ /// </summary>
+ /// <returns></returns>
+ public int GetTaskNo()
+ {
+ DataTable dt = BaseDal.QueryTable("SELECT FORMAT(NEXT VALUE FOR dbo.seqTaskNum, '0000000');");
+ return int.Parse("9"+ dt.Rows[0][0].ToString());
}
/// <summary>
@@ -551,6 +839,15 @@
}
/// <summary>
+ /// 鏌ヨ绉诲簱浠诲姟
+ /// </summary>
+ /// <returns></returns>
+ public Dt_Task QueryStackerCraneTaskByRelotion(int taskNum)
+ {
+ return BaseDal.QueryFirst(x => (x.Roadway == "SC01" )&&x.TaskType==(int)TaskRelocationTypeEnum.Relocation && x.TaskNum==taskNum, TaskOrderBy);
+ }
+
+ /// <summary>
/// 鏌ヨ灏忓爢鍨涙満鍑哄簱瀹屾垚浠诲姟
/// </summary>
/// <returns></returns>
@@ -565,8 +862,19 @@
/// <param name="deviceNo"></param>
/// <returns></returns>
public Dt_Task QueryStackerCraneTaskByAGVRequest(string deviceNo)
- {
+ {
return BaseDal.QueryFirst(x => x.Roadway == deviceNo && (TaskInboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskInStatusEnum.InNew), TaskOrderBy);
+ }
+
+ /// <summary>
+ /// 鏌ヨAGV杩涘叆涓殑鍏ュ簱浠诲姟
+ /// </summary>
+ /// <param name="deviceNo"></param>
+ /// <returns></returns>
+ public Dt_Task QueryStackerCraneTaskByAGVIning(string deviceNo)
+ {
+
+ return BaseDal.QueryFirst(x => x.Roadway == deviceNo && (TaskInboundTypes.Contains(x.TaskType)&&x.CurrentAddress=="1"), TaskOrderBy);
}
/// <summary>
/// 瀵瑰簲WMS璇锋眰 3001-AGV鏀捐揣瀹屾垚
@@ -646,13 +954,63 @@
_taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, task.ExceptionMessage);
- content = WebResponseContent.Instance.OK();
+
}
catch (Exception ex)
{
content = WebResponseContent.Instance.Error(ex.Message);
}
return content;
+ }
+
+ /// <summary>
+ /// 鑷姩鍏ュ簱鏃舵洿鏂版槸鍚﹁繘鍏ュ崌闄嶆満鏍囧織锛�0锛屾湭杩涘叆 1锛屽凡杩涘叆锛�
+ /// </summary>
+ /// <param name="taskNum"></param>
+ /// <param name="Inflag"></param>
+ /// <returns></returns>
+ public WebResponseContent UpdateTaskAllowIn(int taskNum, int Inflag)
+ {
+ WebResponseContent content = new WebResponseContent();
+ try
+ {
+ Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum);
+ if (task == null) return WebResponseContent.Instance.Error($"鏈壘鍒拌浠诲姟淇℃伅,浠诲姟鍙�:銆恵taskNum}銆�");
+ task.CurrentAddress = Inflag.ToString();
+ task.ModifyDate = DateTime.Now;
+ BaseDal.UpdateData(task);
+ }
+ catch (Exception ex)
+ {
+ content = WebResponseContent.Instance.Error(ex.Message);
+ }
+ return content;
+
+ }
+
+ /// <summary>
+ /// 鏄惁宸插洖浼燤ES2001鏍囧織锛�0锛屾湭鍥炰紶 1锛屽凡鍥炰紶锛�
+ /// </summary>
+ /// <param name="taskNum"></param>
+ /// <param name="Inflag"></param>
+ /// <returns></returns>
+ public WebResponseContent UpdateTaskIsBack(int taskNum, int Inflag)
+ {
+ WebResponseContent content = new WebResponseContent();
+ try
+ {
+ Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum);
+ if (task == null) return WebResponseContent.Instance.Error($"鏈壘鍒拌浠诲姟淇℃伅,浠诲姟鍙�:銆恵taskNum}銆�");
+ task.Remark = Inflag.ToString();
+ task.ModifyDate = DateTime.Now;
+ BaseDal.UpdateData(task);
+ }
+ catch (Exception ex)
+ {
+ content = WebResponseContent.Instance.Error(ex.Message);
+ }
+ return content;
+
}
/// <summary>
@@ -668,6 +1026,277 @@
task.Modifier = "System";
task.ModifyDate = DateTime.Now;
BaseDal.UpdateData(task);
+ }
+
+ /// <summary>
+ /// 浠诲姟寮哄埗瀹屾垚 鍫嗗灈鏈哄疄闄呭凡瀹屾垚浠诲姟锛學CS鏈敹鍒板畬鎴愪俊鍙锋垨鍏朵粬鏈煡鍘熷洜瀵艰嚧WCS浠诲姟鏈畬鎴愶紝鍙互鎵ц璇ユ柟娉曞己鍒跺畬鎴愪换鍔�
+ /// </summary>
+ /// <param name="taskNum"></param>
+ /// <returns></returns>
+ public WebResponseContent ForceCompleteTask(int taskNum)
+ {
+ WebResponseContent content = new WebResponseContent();
+ try
+ {
+ bool isBack = false;
+ //1锛屽厛鏌ヨ浠诲姟锛屾牴鎹笉鍚岀殑浠诲姟绫诲瀷鍋氫换鍔″己鍒跺畬鎴愭搷浣�
+ Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == taskNum);
+ if (task == null) return WebResponseContent.Instance.Error($"鏈壘鍒拌浠诲姟淇℃伅,浠诲姟鍙�:銆恵taskNum}銆�");
+
+ Dt_LocationInfo locationsrc = _locationInfoRepository.QueryFirst(x => x.LocationCode == task.SourceAddress.ToString());
+ Dt_LocationInfo locationdsc = _locationInfoRepository.QueryFirst(x => x.LocationCode == task.TargetAddress.ToString());
+ if (task.TaskType == (int)TaskInboundTypeEnum.Inbound)
+ {
+ if (task.TaskState == (int)TaskInStatusEnum.SC_InExecuting)
+ {
+ task.TaskState = (int)TaskInStatusEnum.SC_InFinish;
+ //闇�瑕佸皢鐩爣鍦板潃鏀逛负鏈夎揣鐘舵��
+ locationdsc.LocationStatus = (int)LocationStatusEnum.InStock;
+
+ //鏇存柊鐘舵�佷负浠诲姟瀹屾垚
+ UpdateTaskStatus(task.TaskId, task.TaskState);
+ _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"鍫嗗灈鏈哄叆搴撳畬鎴�");
+ _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"鍏ュ簱浠诲姟瀹屾垚");
+ //鏇存柊璐т綅
+ _locationInfoRepository.UpdateData(locationdsc);
+ isBack = true;
+
+ }
+ else
+ {
+ return content = WebResponseContent.Instance.Error("璇ヤ换鍔$洰鍓嶇姸鎬侊紝涓嶅厑璁″己鍒跺畬鎴愶紒");
+ }
+
+ }
+ else
+ {
+ if (task.TaskState == (int)TaskOutStatusEnum.SC_OutExecuting)
+ {
+
+ if (task.TaskType == (int)TaskOutboundTypeEnum.OutInventory || task.TaskType == (int)TaskOutboundTypeEnum.OutPick)//寮傚父鍑哄簱 绌鸿溅鍑哄簱
+ {
+ task.TaskState = (int)TaskOutStatusEnum.OutFinish;
+ //婧愬湴鍧�鏇存柊涓虹┖闂�
+ locationsrc.LocationStatus = (int)LocationStatusEnum.Free;
+
+ //鏇存柊鐘舵�佷负浠诲姟瀹屾垚
+ UpdateTaskStatus(task.TaskId, task.TaskState);
+ _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"鍫嗗灈鏈哄嚭搴撳畬鎴�");
+ _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"鍑哄簱浠诲姟瀹屾垚");
+ //鏇存柊璐т綅
+ _locationInfoRepository.UpdateData(locationsrc);
+ isBack = true;
+ }
+ else if (task.TaskType == (int)TaskRelocationTypeEnum.Relocation)//绉诲簱
+ {
+ task.TaskState = (int)TaskOutStatusEnum.OutFinish;
+ //婧愬湴鍧�鏇存柊涓虹┖闂�
+ locationsrc.LocationStatus = (int)LocationStatusEnum.Free;
+ //鐩爣鍦板潃鏇存柊涓烘湁璐�
+ locationdsc.LocationStatus = (int)LocationStatusEnum.InStock;
+
+
+ //鏇存柊鐘舵�佷负浠诲姟瀹屾垚
+ UpdateTaskStatus(task.TaskId, task.TaskState);
+ _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"鍫嗗灈鏈哄嚭搴撳畬鎴�");
+ _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"鍑哄簱浠诲姟瀹屾垚");
+ //鏇存柊璐т綅
+ _locationInfoRepository.UpdateData(locationsrc);
+ _locationInfoRepository.UpdateData(locationdsc);
+ isBack = true;
+
+
+ }
+ else//涓婃枡浠诲姟涔熸敼涓哄己鍒跺畬鎴�20250115
+ {
+ //鏇存柊鐘舵�佷负浠诲姟瀹屾垚
+ //task.TaskState = (int)TaskOutStatusEnum.OutFinish;
+ //UpdateTaskStatus(task.TaskId, task.TaskState);
+ //_taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"鍫嗗灈鏈哄嚭搴撳畬鎴�");
+ //_taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"鍑哄簱浠诲姟瀹屾垚");
+ //isBack = true;
+ return WebResponseContent.Instance.Error($"涓婃枡浠诲姟涓嶅厑璁″己鍒跺畬鎴愶紒");
+ }
+ }
+ else
+ {
+ return WebResponseContent.Instance.Error($"璇ヤ换鍔$姸鎬佷笉鍏佽寮哄埗瀹屾垚锛�");
+ }
+ }
+
+ //浠诲姟寮哄埗瀹屾垚鍥炶皟MES
+ if (isBack)
+ {
+
+ if (task.TaskType == (int)TaskInboundTypeEnum.Inbound)//鍏ュ簱鏃跺洖浼犻渶浼犳柊浠诲姟鍙�
+ {
+ task.TaskNum =int.Parse(task.NextAddress);
+ }
+ MESSendCMD sendcmd = new MESSendCMD { cmd = 201, task_id = task.TaskNum, status = 6 };
+ MESResponse res = ApiInvoke.SendTaskCMD(sendcmd);
+ if (res != null && res.code != 0)
+ {
+ ServiceLogger.WriteDebug("ForceCompleteTask", $"浠诲姟寮哄埗瀹屾垚鍚庡洖浼燤ES澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵res.message}銆�");
+ content = WebResponseContent.Instance.Error($"浠诲姟寮哄埗瀹屾垚鍚庡洖浼燤ES澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵res.message}銆�");
+ }
+ else
+ {
+ ServiceLogger.WriteDebug("ForceCompleteTask", $"浠诲姟寮哄埗瀹屾垚鍚庡洖浼燤ES鎴愬姛锛�,浠诲姟鍙�:銆恵taskNum}銆�");
+ content = WebResponseContent.Instance.Error($"澶у爢鍨涙満瀹屾垚鍚庡洖浼燤ES鎴愬姛锛�,浠诲姟鍙�:銆恵taskNum}銆�");
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ content = WebResponseContent.Instance.Error(ex.Message);
+ }
+ return content;
+
+ }
+
+ /// <summary>
+ /// 鍏佽閲嶇疆
+ /// </summary>
+ /// <param name="taskNum"></param>
+ /// <returns></returns>
+ public WebResponseContent AGVResetTask()
+ {
+ WebResponseContent content = new WebResponseContent();
+ Dt_Task task = _taskRepository.QueryFirst(x => x.CurrentAddress == "1");
+ if (task != null)
+ {
+ UpdateTaskAllowIn(task.TaskNum, 0);
+ }
+ else
+ {
+ return WebResponseContent.Instance.Error($"鐩墠鏄厑璁GV杩涘叆鐘舵�侊紝鏃犻渶閲嶇疆锛�");
+ }
+ return content.Error("閲嶇疆鎴愬姛锛�");
+ }
+
+ /// <summary>
+ /// 浠诲姟鍙栨秷
+ /// </summary>
+ /// <param name="taskid"></param>
+ /// <returns></returns>
+ public WebResponseContent CancelTask(int taskNum)
+ {
+ WebResponseContent content = new WebResponseContent();
+ try
+ {
+ //1锛屽厛鏌ヨ浠诲姟锛屾牴鎹笉鍚岀殑浠诲姟绫诲瀷鍋氫换鍔″彇娑堟搷浣�
+ Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == taskNum);
+ if (task == null) return WebResponseContent.Instance.Error($"鏈壘鍒拌浠诲姟淇℃伅,浠诲姟鍙�:銆恵taskNum}銆�");
+
+ //鍙栨秷浠诲姟鏃讹紝閲嶇疆鏄惁鍏佽杩涘叆
+ if (task.CurrentAddress == "1")
+ {
+ UpdateTaskAllowIn(task.TaskNum, 0);
+ }
+
+ Dt_LocationInfo locationsrc = _locationInfoRepository.QueryFirst(x => x.LocationCode == task.SourceAddress.ToString());
+ Dt_LocationInfo locationdsc = _locationInfoRepository.QueryFirst(x => x.LocationCode == task.TargetAddress.ToString());
+ bool isBack = false;
+ //濡傛灉鏄叆搴撳垎鑷姩鍜屾墜鍔ㄤ袱绉嶆儏鍐靛鐞�
+ if (task.TaskType == (int)TaskInboundTypeEnum.Inbound)
+ {
+ if (task.WMSId == 0 && task.TaskState == (int)TaskInStatusEnum.InNew)//鑷姩鍏ュ簱锛�1001-AGV璇锋眰鏄惁鍏佽杩涘叆锛屼换鍔$姸鎬佷负鈥滄柊寤哄叆搴撲换鍔�200鈥濅箣鍓嶅彲浠ュ彇娑�
+ {
+ task.TaskState = (int)TaskInStatusEnum.InCancel;
+ //闇�瑕佸皢鐩爣鍦板潃鎭㈠涓虹┖闂茬姸鎬�
+ locationdsc.LocationStatus = (int)LocationStatusEnum.Free;
+ //鏇存柊鐘舵�佷负浠诲姟鍙栨秷
+ UpdateTaskStatus(task.TaskId, task.TaskState);
+ _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"鍏ュ簱浠诲姟鍙栨秷");
+ _locationInfoRepository.UpdateData(locationdsc);
+ isBack = true;
+ }
+ else if (task.WMSId == 1 && task.TaskState == (int)TaskInStatusEnum.AGV_InExecuting)//鎵嬪姩鍏ュ簱锛�3001-AGV鏀捐揣瀹屾垚锛屼换鍔$姸鎬佷负鈥淎GV鍏ュ簱鎵ц涓�210鈥濅箣鍓嶅彲浠ュ彇娑�
+ {
+ task.TaskState = (int)TaskInStatusEnum.InCancel;
+ //闇�瑕佸皢鐩爣鍦板潃鎭㈠绌洪棽鐘舵��
+ locationdsc.LocationStatus = (int)LocationStatusEnum.Free;
+ //鏇存柊鐘舵�佷负浠诲姟鍙栨秷
+ UpdateTaskStatus(task.TaskId, task.TaskState);
+ _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"鍏ュ簱浠诲姟鍙栨秷");
+ _locationInfoRepository.UpdateData(locationdsc);
+ isBack = true;
+ }
+ else
+ {
+ return WebResponseContent.Instance.Error($"璇ヤ换鍔$姸鎬佷笉鍏佽鍙栨秷锛�");
+ }
+ }
+ else//鍏朵粬浠诲姟锛屼换鍔$姸鎬佲�滄柊寤哄嚭搴撲换鍔♀�濅箣鍓嶏紝鎵嶅彲浠ュ彇娑�
+ {
+ if (task.TaskState == (int)TaskOutStatusEnum.OutNew)
+ {
+ if(task.TaskType == (int)TaskOutboundTypeEnum.OutInventory|| task.TaskType == (int)TaskOutboundTypeEnum.OutPick)//寮傚父鍑哄簱 绌鸿溅鍑哄簱
+ {
+ task.TaskState = (int)TaskOutStatusEnum.OutCancel;
+ //婧愬湴鍧�鎭㈠鍒版湁璐�
+ locationsrc.LocationStatus = (int)LocationStatusEnum.InStock;
+
+ //鏇存柊鐘舵�佷负浠诲姟鍙栨秷
+ UpdateTaskStatus(task.TaskId, task.TaskState);
+ _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"鍑哄簱浠诲姟鍙栨秷");
+ _locationInfoRepository.UpdateData(locationsrc);
+ isBack = true;
+ }
+ else if(task.TaskType == (int)TaskRelocationTypeEnum.Relocation)//绉诲簱
+ {
+ task.TaskState = (int)TaskOutStatusEnum.OutCancel;
+ //婧愬湴鍧�鎭㈠鍒版湁璐�
+ locationsrc.LocationStatus = (int)LocationStatusEnum.InStock;
+ //闇�瑕佸皢鐩爣鍦板潃鎭㈠绌洪棽鐘舵��
+ locationdsc.LocationStatus = (int)LocationStatusEnum.Free;
+ //鏇存柊鐘舵�佷负浠诲姟鍙栨秷
+ UpdateTaskStatus(task.TaskId, task.TaskState);
+ _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"鍑哄簱浠诲姟鍙栨秷");
+ _locationInfoRepository.UpdateData(locationsrc);
+ _locationInfoRepository.UpdateData(locationdsc);
+ isBack = true;
+ }
+ else
+ {
+ return WebResponseContent.Instance.Error($"涓婃枡浠诲姟涓嶅厑璁″彇娑堬紒");
+ }
+ }
+ else
+ {
+ return WebResponseContent.Instance.Error($"璇ヤ换鍔$姸鎬佷笉鍏佽鍙栨秷锛�");
+ }
+ }
+
+
+
+ //浠诲姟鍙栨秷鍥炶皟MES
+ if (isBack)
+ {
+ MESSendCMD sendcmd = new MESSendCMD { cmd = 201, task_id = task.TaskNum, status = 3 };
+ MESResponse res = ApiInvoke.SendTaskCMD(sendcmd);
+ if (res != null && res.code != 0)
+ {
+ ServiceLogger.WriteDebug("ForceCompleteTask", $"浠诲姟鍙栨秷鍥炰紶MES澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵res.message}銆�");
+ content = WebResponseContent.Instance.Error($"浠诲姟鍙栨秷鍥炰紶MES澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵res.message}銆�");
+ }
+ else
+ {
+ ServiceLogger.WriteDebug("ForceCompleteTask", $"浠诲姟鍙栨秷鍥炰紶MES鎴愬姛锛�,浠诲姟鍙�:銆恵taskNum}銆�");
+ content = WebResponseContent.Instance.Error($"浠诲姟鍙栨秷鍥炰紶MES鎴愬姛锛�,浠诲姟鍙�:銆恵taskNum}銆�");
+ }
+ }
+ else
+ {
+
+ }
+
+ }
+ catch (Exception ex)
+ {
+ content = WebResponseContent.Instance.Error(ex.Message);
+ }
+ return content;
}
@@ -840,17 +1469,37 @@
_unitOfWorkManage.CommitTran();
//鍑哄簱瀹屾垚锛屽洖浼燱MS
//鍥炰紶鍒癢MS
- MESSendCMD sendcmd = new MESSendCMD { cmd = 201, task_id = task.TaskNum, status = 6 };
- MESResponse res = ApiInvoke.SendTaskCMD(sendcmd);
- if (res != null && res.code != 0)
+ if (task.TaskType == (int)TaskOutboundTypeEnum.OutPick)
{
- content = WebResponseContent.Instance.Error($"澶у爢鍨涙満瀹屾垚鍑哄簱浠诲姟鍚庡洖浼燤ES澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵res.message}銆�");
+ MESSendCMD sendcmd = new MESSendCMD { cmd = 201, task_id = task.TaskNum, status = 6 };
+ MESResponse res = ApiInvoke.SendTaskCMD(sendcmd);
+ if (res != null && res.code != 0)
+ {
+ ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"澶у爢鍨涙満瀹屾垚绌鸿溅鍑哄簱浠诲姟鍚庡洖浼燤ES澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵res.message}銆�");
+ content = WebResponseContent.Instance.Error($"澶у爢鍨涙満瀹屾垚绌鸿溅鍑哄簱浠诲姟鍚庡洖浼燤ES澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵res.message}銆�");
+ }
+
+ }
+ else
+ {
+ if (task.WMSId != 3)
+ {
+ MESSendCMD sendcmd = new MESSendCMD { cmd = 201, task_id = task.TaskNum, status = 6 };
+ MESResponse res = ApiInvoke.SendTaskCMD(sendcmd);
+ if (res != null && res.code != 0)
+ {
+ ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"澶у爢鍨涙満瀹屾垚寮傚父鍑哄簱浠诲姟鍚庡洖浼燤ES澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵res.message}銆�");
+ content = WebResponseContent.Instance.Error($"澶у爢鍨涙満瀹屾垚寮傚父鍑哄簱浠诲姟鍚庡洖浼燤ES澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵res.message}銆�");
+ }
+ }
}
}
catch (Exception ex)
{
_unitOfWorkManage.RollbackTran();
+
+ ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"澶у爢鍨涙満鎵ц鍑哄簱浠诲姟澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵ex.Message}銆�");
content = WebResponseContent.Instance.Error($"澶у爢鍨涙満鎵ц鍑哄簱浠诲姟澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵ex.Message}銆�");
}
@@ -880,16 +1529,28 @@
//鍏ュ簱瀹屾垚锛屽洖浼燤ES 鍏ュ簱瀹屾垚鍥炰紶task.NextAddress 涔嬪墠101璇锋眰鏃跺瓨鐨勬柊浠诲姟鍙�
MESSendCMD sendcmd = new MESSendCMD { cmd = 201, task_id = int.Parse(task.NextAddress), status = 6 };
- MESResponse res = ApiInvoke.SendTaskCMD(sendcmd);
- if (res != null && res.code != 0)
+ string inparam = JsonConvert.SerializeObject(sendcmd);
+ ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"澶у爢鍨涙満瀹屾垚鍏ュ簱浠诲姟鍚庡洖浼燤ES鍏ュ弬:{inparam}");
+ if (task.WMSId != 3)
{
- content = WebResponseContent.Instance.Error($"澶у爢鍨涙満瀹屾垚鍏ュ簱浠诲姟鍚庡洖浼燤ES澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵res.message}銆�");
+ MESResponse res = ApiInvoke.SendTaskCMD(sendcmd);
+ if (res != null && res.code != 0)
+ {
+
+ ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"澶у爢鍨涙満瀹屾垚鍏ュ簱浠诲姟鍚庡洖浼燤ES澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵res.message}銆�");
+ content = WebResponseContent.Instance.Error($"澶у爢鍨涙満瀹屾垚鍏ュ簱浠诲姟鍚庡洖浼燤ES澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵res.message}銆�");
+ }
+ else
+ {
+ ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"澶у爢鍨涙満瀹屾垚鍏ュ簱浠诲姟鍚庡洖浼燤ES鎴愬姛锛�,浠诲姟鍙�:銆恵taskNum}銆�");
+ }
}
}
catch (Exception ex)
{
_unitOfWorkManage.RollbackTran();
+ ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"澶у爢鍨涙満鎵ц鍏ュ簱浠诲姟澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵ex.Message}銆�");
content = WebResponseContent.Instance.Error($"澶у爢鍨涙満鎵ц鍏ュ簱浠诲姟澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵ex.Message}銆�");
}
}
@@ -902,7 +1563,7 @@
srcLocation.LocationStatus = (int)LocationStatusEnum.Free;
Dt_LocationInfo tarLocation = _locationInfoRepository.QueryFirst(x => x.LocationCode == task.TargetAddress);
- srcLocation.LocationStatus = (int)LocationStatusEnum.InStock;
+ tarLocation.LocationStatus = (int)LocationStatusEnum.InStock;
UpdateTaskStatus(task.TaskId, (int)TaskOutStatusEnum.SC_OutFinish);
_taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"鍫嗗灈鏈哄嚭搴撳畬鎴�");
@@ -916,17 +1577,42 @@
_unitOfWorkManage.CommitTran();
//绉诲簱瀹屾垚锛屽洖浼燤ES
//鍥炰紶鍒癢MS
- MESSendCMD sendcmd = new MESSendCMD { cmd = 201, task_id = task.TaskNum, status = 6 };
- MESResponse res = ApiInvoke.SendTaskCMD(sendcmd);
- if (res != null && res.code != 0)
+ if (task.WMSId != 3)
{
- content = WebResponseContent.Instance.Error($"澶у爢鍨涙満瀹屾垚鍑哄簱浠诲姟鍚庡洖浼燤ES澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵res.message}銆�");
+ MESSendCMD sendcmd = new MESSendCMD { cmd = 201, task_id = task.TaskNum, status = 6 };
+ string inparam = JsonConvert.SerializeObject(sendcmd);
+ ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"澶у爢鍨涙満瀹屾垚鍑哄簱浠诲姟鍚庡洖浼燤ES鍏ュ弬:{inparam}");
+ MESResponse res = ApiInvoke.SendTaskCMD(sendcmd);
+ if (res != null && res.code != 0)
+ {
+ ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"澶у爢鍨涙満瀹屾垚鍑哄簱浠诲姟鍚庡洖浼燤ES澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵res.message}銆�");
+ content = WebResponseContent.Instance.Error($"澶у爢鍨涙満瀹屾垚鍑哄簱浠诲姟鍚庡洖浼燤ES澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵res.message}銆�");
+ }
}
+ //if(task.TaskType== (int)TaskRelocationTypeEnum.Relocation&&!string.IsNullOrEmpty(task.Remark.Trim()))//鍑哄簱浠诲姟鍐欐�诲眰鏁版爣璇�
+ //{
+ // CommonStackerCrane commonStackerCrane = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "SC01") as CommonStackerCrane;
+ // //鏍规嵁浠诲姟婧愬湴鍧�纭畾鍐欏叆PLC浣嶇疆 Depth
+ // Dt_LocationInfo location = _locationInfoRepository.QueryFirst(x => x.LocationCode == task.TargetAddress);
+ // if (commonStackerCrane!=null&&location != null)
+ // {
+ // bool issuccess = commonStackerCrane.Communicator.Write<short>("DB28." + location.Depth + ".0", 9);
+ // if (issuccess)
+ // {
+ // ServiceLogger.WriteDebug("TaskService", $"鍘熸枡鍑哄簱鍚庡啓鍏ユ爣璇嗘垚鍔燂紒");
+ // }
+ // else
+ // {
+ // ServiceLogger.WriteDebug("TaskService", $"鍘熸枡鍑哄簱鍚庡啓鍏ユ爣璇嗗け璐ワ紒");
+ // }
+ // }
+ //}
}
catch (Exception ex)
{
_unitOfWorkManage.RollbackTran();
+ ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"澶у爢鍨涙満鎵ц鍑哄簱浠诲姟澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵ex.Message}銆�");
content = WebResponseContent.Instance.Error($"澶у爢鍨涙満鎵ц鍑哄簱浠诲姟澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵ex.Message}銆�");
}
}
@@ -935,7 +1621,7 @@
{
try
{
- Dt_LocationInfo srcLocation = _locationInfoRepository.QueryFirst(x => x.LocationCode == task.SourceAddress);
+ //Dt_LocationInfo srcLocation = _locationInfoRepository.QueryFirst(x => x.LocationCode == task.SourceAddress);
//srcLocation.LocationStatus = (int)LocationStatusEnum.Free;
@@ -950,59 +1636,72 @@
_unitOfWorkManage.CommitTran();
//涓婃枡瀹屾垚锛屽洖浼燱MS
MESSendCMD sendcmd = new MESSendCMD { cmd = 201, task_id = task.TaskNum, status = 6 };
+ string inparam = JsonConvert.SerializeObject(sendcmd);
+ ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"灏忓爢鍨涙満鎵ц鍑哄簱浠诲姟鍥炰紶MES鍏ュ弬{inparam}");
MESResponse res = ApiInvoke.SendTaskCMD(sendcmd);
if (res != null && res.code != 0)
{
+ ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"灏忓爢鍨涙満瀹屾垚鍑哄簱浠诲姟鍚庡洖浼燤ES澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵res.message}銆�");
content = WebResponseContent.Instance.Error($"灏忓爢鍨涙満瀹屾垚鍑哄簱浠诲姟鍚庡洖浼燤ES澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵res.message}銆�");
}
- else
- {
- //鍒ゆ柇鏄惁瀹屾垚鐨勬渶鍚庝竴灞傦紝鑷姩鐢熸垚绌鸿溅鍑哄簱浠诲姟
- string[] Levels = task.Remark.Split("-");
- if (Levels.Length == 2)
- {
- if (!string.IsNullOrEmpty(Levels[0])&& !string.IsNullOrEmpty(Levels[1]))
- {
- //濡傛灉褰撳墠鎻愬彇灞傛暟绛変簬鎬诲眰鏂欙紝鍒欒〃绀烘枡杞︽墍鏈夌殑灞傛暟鍙栧畬
- if(Convert.ToInt16(Levels[0])== Convert.ToInt16(Levels[1]))
- {
- string[] SourceCodes = task.SourceAddress.Split("-");
- string startPlan = "";
- if (SourceCodes.Length == 4)
- {
- startPlan= "101"+ SourceCodes[2].Substring(1,2);
- }
- DeliveryPlan send = new DeliveryPlan { startPlan = startPlan, isQuit = false, CarId = task.PalletCode };
- ApiInvoke.DeliveryPlanCMD(send);//鍥炶皟MES鎺ュ彛鐢熸垚绌鸿溅鍑哄簱浠诲姟
-
- }
-
- }
+ //else
+ //{
+ // //鍒ゆ柇鏄惁瀹屾垚鐨勬渶鍚庝竴灞傦紝鑷姩鐢熸垚绌鸿溅鍑哄簱浠诲姟
+ // string[] Levels = task.Remark.Split("-");
+ // if (Levels.Length == 2)
+ // {
+ // if (!string.IsNullOrEmpty(Levels[0])&& !string.IsNullOrEmpty(Levels[1]))
+ // {
+ // //濡傛灉褰撳墠鎻愬彇灞傛暟绛変簬鎬诲眰鏂欙紝鍒欒〃绀烘枡杞︽墍鏈夌殑灞傛暟鍙栧畬
+ // if(Convert.ToInt16(Levels[0])== Convert.ToInt16(Levels[1]))
+ // {
+ // string[] SourceCodes = task.SourceAddress.Split("-");
+ // string startPlan = "";
+ // if (SourceCodes.Length == 4)
+ // {
+ // startPlan = "101" + SourceCodes[2].Substring(1, 2);
+ // }
+ // DeliveryPlan send = new DeliveryPlan { startPlan = startPlan, isQuit = false, CarId = task.PalletCode };
+ // string inparam2 = JsonConvert.SerializeObject(send);
+ // ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"灏忓爢鍨涙満鎵ц鍑哄簱浠诲姟鍥炰紶MES鍏ュ弬{inparam2}");
+ // ApiInvoke.DeliveryPlanCMD(send);//鍥炶皟MES鎺ュ彛鐢熸垚绌鸿溅鍑哄簱浠诲姟
+ // 鎵�鏈夌殑灞傛暟閮藉彇瀹岋紝闇�瑕佹妸鏆傚瓨浣嶇姸鎬佹敼涓虹┖闂茬姸鎬�
+ // srcLocation.LocationStatus = (int)LocationStatusEnum.Free;
+ // _locationInfoRepository.UpdateData(srcLocation);
+ // }
+
+ // }
- }
- }
+ // }
+ //}
}
catch (Exception ex)
{
_unitOfWorkManage.RollbackTran();
+ ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"灏忓爢鍨涙満鎵ц鍑哄簱浠诲姟澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵ex.StackTrace}銆�");
content = WebResponseContent.Instance.Error($"灏忓爢鍨涙満鎵ц鍑哄簱浠诲姟澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵ex.Message}銆�");
}
}
else
{
+ ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"浠诲姟绫诲瀷閿欒,鏈壘鍒拌浠诲姟绫诲瀷,浠诲姟鍙�:銆恵taskNum}銆�,浠诲姟绫诲瀷:銆恵task.TaskType}銆�");
throw new Exception($"浠诲姟绫诲瀷閿欒,鏈壘鍒拌浠诲姟绫诲瀷,浠诲姟鍙�:銆恵taskNum}銆�,浠诲姟绫诲瀷:銆恵task.TaskType}銆�");
}
- content = WebResponseContent.Instance.OK();
+ ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"浠诲姟瀹屾垚鎴愬姛,浠诲姟鍙�:銆恵taskNum}銆�");
+ content = WebResponseContent.Instance.OK($"浠诲姟瀹屾垚鎴愬姛,浠诲姟鍙�:銆恵taskNum}銆�");
}
catch (Exception ex)
{
- content = WebResponseContent.Instance.Error($"浠诲姟瀹屾垚寮傚父,浠诲姟鍙�:銆恵taskNum}銆�");
+ ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"浠诲姟瀹屾垚寮傚父,浠诲姟鍙�:銆恵taskNum}銆憑ex.Message}");
+ content = WebResponseContent.Instance.Error($"浠诲姟瀹屾垚寮傚父,浠诲姟鍙�:銆恵taskNum}銆憑ex.Message}");
}
return content;
}
+
+
/// <summary>
/// 鎭㈠鎸傝捣浠诲姟
/// </summary>
--
Gitblit v1.9.3