using HslCommunication;
|
using Microsoft.EntityFrameworkCore;
|
using System;
|
using System.Linq;
|
using System.Threading;
|
using System.Threading.Tasks;
|
using WIDESEA_Common;
|
using WIDESEA_Common.DBHelper;
|
using WIDESEA_Common.Tools;
|
using WIDESEA_Core.EFDbContext;
|
using WIDESEA_Entity.DomainModels;
|
using WIDESEA_Services.IRepositories;
|
using WIDESEA_Services.Repositories;
|
using WIDESEA_WCS.EquipBaseInfo;
|
using WIDESEA_WCS.WCSClient;
|
|
namespace WIDESEA_WCS.SchedulerExecute.AGV
|
{
|
public partial class AGVSchedulerExecute
|
{
|
private static int _readSendAGVTaskSignalso = 0;
|
private static bool isTrue1 = false;
|
private static string name1 = "";
|
public static void SendAGVTask1(PLCClient plcClient)
|
{
|
if (Interlocked.Exchange(ref _readSendAGVTaskSignalso, 1) == 0)
|
{
|
try
|
{
|
if (plcClient == null) { return; }
|
////WriteLog.Info($"{plcClient.PLCName}SendAGVTask").Write($"---------------开始记录,时间:{DateTime.Now}------------", $"{plcClient.PLCName}SendAGVTask");
|
VOLContext context = new VOLContext();
|
Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(context);
|
Ibase_ware_locationRepository locationRepository = new base_ware_locationRepository(context);
|
int TaskInteractive = Convert.ToInt32(plcClient.ReadValue(TaskDBName.taskInteractiveR.ToString()));//1收到
|
int TaskInteractiveW = Convert.ToInt32(plcClient.ReadValue(TaskDBName.taskInteractiveW.ToString()));//0初始/1下发/2取消/3更改
|
int resetTaskInteractiveW = Convert.ToInt32(plcClient.ReadValue(TaskDBName.resetTaskInteractiveW.ToString()));
|
////WriteLog.Info($"{plcClient.PLCName}SendAGVTask").Write($"读取 { plcClient.PLCName},DB偏移值:DB1000.114,读取值:{TaskInteractive},时间:{DateTime.Now}", $"{plcClient.PLCName}SendAGVTask");
|
////WriteLog.Info($"{plcClient.PLCName}SendAGVTask").Write($"读取 { plcClient.PLCName},DB偏移值:DB1000.112,读取值:{TaskInteractiveW},时间:{DateTime.Now}", $"{plcClient.PLCName}SendAGVTask");
|
////WriteLog.Info($"{plcClient.PLCName}SendAGVTask").Write($"读取 { plcClient.PLCName},DB偏移值:DB1000.118,读取值:{resetTaskInteractiveW},时间:{DateTime.Now}", $"{plcClient.PLCName}SendAGVTask");
|
if (isTrue1 && name1 == plcClient.PLCName)
|
{
|
if (TaskInteractiveW != 0 || resetTaskInteractiveW != 0 || TaskInteractive != 0)
|
{
|
bool fw = plcClient.WriteValue(TaskDBName.resetTaskInteractiveW.ToString(), 1);
|
Task.Delay(2000).Wait();
|
resetTaskInteractiveW = Convert.ToInt32(plcClient.ReadValue(TaskDBName.resetTaskInteractiveW.ToString()));
|
if (resetTaskInteractiveW == 1)
|
{
|
plcClient.WriteValue(TaskDBName.resetTaskInteractiveW.ToString(), 0);
|
plcClient.WriteValue(TaskDBName.taskInteractiveW.ToString(), 0);
|
Task.Delay(2000).Wait();
|
}
|
return;
|
}
|
else
|
{
|
isTrue1 = false;
|
name1 = "";
|
}
|
}
|
else if (resetTaskInteractiveW == 1)
|
{
|
plcClient.WriteValue(TaskDBName.resetTaskInteractiveW.ToString(), 0);
|
plcClient.WriteValue(TaskDBName.taskInteractiveW.ToString(), 0);
|
Task.Delay(2000).Wait();
|
return;
|
}
|
if (TaskInteractive == 0 && TaskInteractiveW == 0)
|
{
|
dt_agvtask agvTask = agvtaskRepository.Find(r => r.agv_taskstate == "Create" && r.agv_code == plcClient.PLCName && r.agv_tasktype.Contains("TaskType_Outbound")).OrderBy(r => r.agv_createtime).OrderByDescending(r => r.agv_grade).FirstOrDefault();
|
if (null != agvTask)
|
{
|
//写入任务信息
|
string rel = AGVBaseInfo.TaskWrite(plcClient, agvTask, AGVJobEnum.newTaskEnum);
|
Thread.Sleep(1000);
|
string taskId = plcClient.ReadValue(TaskDBName.taskID.ToString()).ToString();
|
|
if (taskId != agvTask.agv_tasknum)
|
{
|
isTrue1 = true;
|
name1 = plcClient.PLCName;
|
////WriteLog.Info($"{plcClient.PLCName}SendAGVTask").Write($"读取 给AGV写入任务失败,读取AGV的taskid:{agvTask.agv_tasknum}, AGV任务队列中不存在,时间:{ DateTime.Now}", $"{plcClient.PLCName}SendAGVTask");
|
////WriteLog.Info($"{plcClient.PLCName}SendAGVTask").Write($"给AGV写入任务失败,任务号{0},时间:{ DateTime.Now}", $"{plcClient.PLCName}SendAGVTask");
|
////WriteLog.Info($"{plcClient.PLCName}SendAGVTask").Write($"---------------结束记录,时间:{DateTime.Now}------------ {Environment.NewLine}", $"{plcClient.PLCName}SendAGVTask");
|
return;
|
//throw new Exception(string.Format("给AGV写入任务失败,任务号{0}", agvTask.agv_tasknum));
|
}
|
if (string.IsNullOrEmpty(rel))
|
{
|
//写入任务确认1
|
bool taskInteractiveW = plcClient.WriteValue(TaskDBName.taskInteractiveW.ToString(), 1);
|
Thread.Sleep(1000);
|
////WriteLog.Info($"{plcClient.PLCName}SendAGVTask").Write($"写入 任务号:{agvTask.agv_tasknum},偏移值:DB1000.112,写入AGV信号:1,写入反馈结果:{taskInteractiveW}", $"{plcClient.PLCName}SendAGVTask");
|
//读取AGV信号
|
int ReadTask_1_OK = Convert.ToInt32(plcClient.ReadValue(TaskDBName.taskInteractiveR.ToString()));
|
////WriteLog.Info($"{plcClient.PLCName}SendAGVTask").Write($"读取 任务号:{agvTask.agv_tasknum},偏移值:DB1000.114,读取AGV信号:{ReadTask_1_OK},读取反馈结果:{Convert.ToBoolean(ReadTask_1_OK)}", $"{plcClient.PLCName}SendAGVTask");
|
if (ReadTask_1_OK == 1)
|
{
|
//写入WCS确认信号0
|
bool taskInteractiveW2 = plcClient.WriteValue(TaskDBName.taskInteractiveW.ToString(), 0);
|
Thread.Sleep(2000);
|
////WriteLog.Info($"{plcClient.PLCName}SendAGVTask").Write($"任务号:{agvTask.agv_tasknum},偏移值:DB1000.112,写入AGV信号:0,写入反馈结果:{taskInteractiveW2}", $"{plcClient.PLCName}SendAGVTask");
|
//读取AGV信号是否为0
|
int ReadTask_0_OK = Convert.ToInt32(plcClient.ReadValue(TaskDBName.taskInteractiveR.ToString()));
|
////WriteLog.Info($"{plcClient.PLCName}SendAGVTask").Write($"任务号:{agvTask.agv_tasknum},偏移值:DB1000.114,读取AGV信号:{ReadTask_0_OK},读取反馈结果:{Convert.ToBoolean(ReadTask_0_OK)}", $"{plcClient.PLCName}SendAGVTask");
|
|
if (ReadTask_0_OK == 0)
|
{
|
agvTask.agv_taskstate = AGVTaskStateEnum.SendOut.ToString();
|
agvTask.agv_realesstime = DateTime.Now;
|
int agvtsask = agvtaskRepository.Update(agvTask, true);
|
//if (agvtsask!=1)
|
//{
|
// ////WriteLog.Info($"{plcClient.PLCName}SendAGVTask").Write($"任务号:{agvTask.agv_tasknum},内容:任务修改失败,反馈值:{agvtsask}", $"{plcClient.PLCName}SendAGVTask");
|
// ////WriteLog.Info($"{plcClient.PLCName}SendAGVTask").Write($"---------------结束记录,时间:{DateTime.Now}------------ {Environment.NewLine}", $"{plcClient.PLCName}SendAGVTask");
|
// return;
|
//}
|
//else
|
//{
|
// ////WriteLog.Info($"{plcClient.PLCName}SendAGVTask").Write($"任务号:{agvTask.agv_tasknum},内容:货位状态已修改未【已下发】状态,任务修改成功,反馈值:{agvtsask}", $"{plcClient.PLCName}SendAGVTask");
|
//}
|
}
|
else
|
{
|
isTrue1 = true;
|
name1 = plcClient.PLCName;
|
////WriteLog.Info($"{plcClient.PLCName}SendAGVTask").Write($"给AGV写入任务确认0失败 任务号{agvTask.agv_tasknum}" + DateTime.Now, $"{plcClient.PLCName}SendAGVTask");
|
////WriteLog.Info($"{plcClient.PLCName}SendAGVTask").Write($"---------------结束记录,时间:{DateTime.Now}------------ {Environment.NewLine}", $"{plcClient.PLCName}SendAGVTask");
|
return;
|
//throw new Exception(string.Format("给AGV写入任务确认0失败,任务号{0}", agvTask.agv_tasknum));
|
}
|
}
|
else if (ReadTask_1_OK == 11)
|
{
|
plcClient.WriteValue(TaskDBName.taskInteractiveW.ToString(), 0);
|
Thread.Sleep(2000);
|
int ReadTask_0_Error = Convert.ToInt32(plcClient.ReadValue(TaskDBName.taskInteractiveR.ToString()));
|
if (ReadTask_0_Error == 0)
|
{
|
agvTask.agv_taskstate = AGVTaskStateEnum.SendOut.ToString();
|
agvTask.agv_realesstime = DateTime.Now;
|
agvtaskRepository.Update(agvTask, true);
|
}
|
else
|
{
|
isTrue1 = true;
|
name1 = plcClient.PLCName;
|
throw new Exception(string.Format("给AGV写入任务异常确认0失败,任务号{0}", agvTask.agv_tasknum));
|
}
|
}
|
else
|
{
|
isTrue1 = true;
|
name1 = plcClient.PLCName;
|
throw new Exception(string.Format("给AGV写入任务确认1失败,任务号{0}", agvTask.agv_tasknum));
|
}
|
}
|
else
|
{
|
isTrue1 = true;
|
name1 = plcClient.PLCName;
|
throw new Exception(string.Format("给AGV写入任务失败,任务号{0}" + "," + rel, agvTask.agv_tasknum));
|
}
|
}
|
else
|
{
|
|
////WriteLog.Info($"{plcClient.PLCName}SendAGVTask").Write($"---------------结束记录,时间:{DateTime.Now}------------ {Environment.NewLine}", $"{plcClient.PLCName}SendAGVTask");
|
////WriteLog.Info($"{plcClient.PLCName}AGV取消未执行任务").Write($"---------------开始记录,时间:{DateTime.Now}------------", $"{plcClient.PLCName}AGV取消未执行任务");
|
////var ddd = plcClient.SiemensPLCClient.SiemensS7NetClient.ReadString("DB1000.320", 30).Content;
|
OperateResult<string> TaskID = plcClient.SiemensPLCClient.SiemensS7NetClient.ReadString("DB1000.320", 30);
|
|
if (TaskID.IsSuccess)
|
{
|
|
TaskID.Content = TaskID.Content?.Replace("\b", "")?.Replace("\\", "")?.Replace("\0", "")?.Replace("\u0004", "")?.Replace("\u0003", "")?.Replace("\u0014", "")?.Replace("\u001e", "")?.Replace("\u0006", "")?.Replace("emptyID", "")?.Replace("mptyID", "")?.Replace("ptyID", "")?.Replace("tyID", "")?.Replace("yID", "")?.Replace("ID", "")?.Replace("\a", "")?.Replace("5-3:20:54:402025123", "");
|
string result = TaskID.Content == null ? "" : TaskID.Content.Trim();
|
////WriteLog.Info($"{plcClient.PLCName}AGV取消未执行任务").Write($"读取 { plcClient.PLCName},DB偏移值:DB1000.320,读取值:{result},时间:{DateTime.Now}", $"{plcClient.PLCName}AGV取消未执行任务");
|
|
if (result != "")
|
{
|
Idt_agvtask_htyRepository agvtask_HtyRepository = new dt_agvtask_htyRepository(context);
|
dt_agvtask aTask = agvtaskRepository.FindFirst(d => d.agv_tasknum == result);
|
if (aTask != null)
|
{
|
//agvTask.agv_worktype = 2;
|
string rel = AGVBaseInfo.TaskWrite(plcClient, aTask, AGVJobEnum.cancelTaskEnum);
|
Thread.Sleep(1000);
|
string taskId = plcClient.ReadValue(TaskDBName.taskID.ToString()).ToString();
|
if (taskId != aTask.agv_tasknum)
|
{
|
isTrue1 = true;
|
name1 = plcClient.PLCName;
|
////WriteLog.Info($"{plcClient.PLCName}AGV取消未执行任务").Write("给AGV写入任务失败,读取AGV的taskid" + aTask.agv_tasknum + "AGV任务队列中不存在" + DateTime.Now, $"{plcClient.PLCName}AGV取消未执行任务");
|
////WriteLog.Info($"{plcClient.PLCName}AGV取消未执行任务").Write($"---------------结束记录,时间:{DateTime.Now}------------ {Environment.NewLine}", $"{plcClient.PLCName}AGV取消未执行任务");
|
return;
|
}
|
if (string.IsNullOrEmpty(rel))
|
{
|
////WriteLog.Info($"{plcClient.PLCName}AGV取消未执行任务").Write($"任务号:{aTask.agv_tasknum},给AGV写入取消任务成功, 时间:{ DateTime.Now}", $"{plcClient.PLCName}AGV取消未执行任务");
|
//写入任务确认1
|
bool taskInteractiveW = plcClient.WriteValue(TaskDBName.taskInteractiveW.ToString(), 2);
|
Thread.Sleep(1000);
|
////WriteLog.Info($"{plcClient.PLCName}AGV取消未执行任务").Write($"任务号:{aTask.agv_tasknum},偏移值:DB1000.112,写入AGV信号:2,写入反馈结果:{taskInteractiveW}", $"{plcClient.PLCName}AGV取消未执行任务");
|
//读取AGV信号
|
int ReadTask_1_OK = Convert.ToInt32(plcClient.ReadValue(TaskDBName.taskInteractiveR.ToString()));
|
////WriteLog.Info($"{plcClient.PLCName}AGV取消未执行任务").Write($"任务号:{aTask.agv_tasknum},偏移值:DB1000.114,读取AGV信号:{ReadTask_1_OK},读取反馈结果:{Convert.ToBoolean(ReadTask_1_OK)}", $"{plcClient.PLCName}AGV取消未执行任务");
|
if (ReadTask_1_OK == 1)
|
{
|
//写入WCS确认信号0
|
bool taskInteractiveW2 = plcClient.WriteValue(TaskDBName.taskInteractiveW.ToString(), 0);
|
Thread.Sleep(2000);
|
////WriteLog.Info($"{plcClient.PLCName}AGV取消未执行任务").Write($"任务号:{aTask.agv_tasknum},偏移值:DB1000.112,写入AGV信号:0,写入反馈结果:{taskInteractiveW2}", $"{plcClient.PLCName}AGV取消未执行任务");
|
//读取AGV信号是否为0
|
int ReadTask_0_OK = Convert.ToInt32(plcClient.ReadValue(TaskDBName.taskInteractiveR.ToString()));
|
////WriteLog.Info($"{plcClient.PLCName}AGV取消未执行任务").Write($"任务号:{aTask.agv_tasknum},偏移值:DB1000.114,读取AGV信号:{ReadTask_0_OK},读取反馈结果:{Convert.ToBoolean(ReadTask_0_OK)}", $"{plcClient.PLCName}AGV取消未执行任务");
|
if (ReadTask_0_OK == 0)
|
{
|
//代表反馈AGV清楚任务成功
|
updateloction(aTask, locationRepository, agvtaskRepository);
|
string Operate = "AGV取消2";
|
agvtask_HtyRepository.AddTaskHistory(aTask, Operate);
|
agvtaskRepository.Delete(aTask, true);
|
////WriteLog.Info($"{plcClient.PLCName}AGV取消未执行任务").Write($"任务号:{aTask.agv_tasknum},成功删除添加历史记录", $"{plcClient.PLCName}AGV取消未执行任务");
|
////WriteLog.Info($"{plcClient.PLCName}AGV取消未执行任务").Write($"---------------结束记录,时间:{DateTime.Now}------------ {Environment.NewLine}", $"{plcClient.PLCName}AGV取消未执行任务");
|
return;
|
}
|
else
|
{
|
isTrue1 = true;
|
name1 = plcClient.PLCName;
|
////WriteLog.Info($"{plcClient.PLCName}AGV取消未执行任务").Write($"给AGV写入任务确认0失败 任务号{aTask.agv_tasknum}" + DateTime.Now, $"{plcClient.PLCName}AGV取消未执行任务");
|
////WriteLog.Info($"{plcClient.PLCName}AGV取消未执行任务").Write($"---------------结束记录,时间:{DateTime.Now}------------ {Environment.NewLine}", $"{plcClient.PLCName}AGV取消未执行任务");
|
return;
|
}
|
}
|
else if (ReadTask_1_OK == 11)
|
{
|
////WriteLog.Info($"{plcClient.PLCName}AGV取消未执行任务").Write($"AGV反馈任务11的异常 任务号{aTask.agv_tasknum}" + DateTime.Now, $"{plcClient.PLCName}AGV取消未执行任务");
|
plcClient.WriteValue(TaskDBName.taskInteractiveW.ToString(), 0);
|
Thread.Sleep(2000);
|
int ReadTask_0_Error = Convert.ToInt32(plcClient.ReadValue(TaskDBName.taskInteractiveR.ToString()));
|
if (ReadTask_0_Error == 0)
|
{
|
updateloction(aTask, locationRepository, agvtaskRepository);
|
string Operate = "AGV取消11";
|
agvtask_HtyRepository.AddTaskHistory(aTask, Operate);
|
agvtaskRepository.Delete(aTask, true);
|
}
|
else
|
{
|
isTrue1 = true;
|
name1 = plcClient.PLCName;
|
////WriteLog.Info($"{plcClient.PLCName}AGV取消未执行任务").Write($"给AGV写入任务异常确认0失败,任务号{0},时间:" + DateTime.Now, $"{plcClient.PLCName}AGV取消未执行任务");
|
////WriteLog.Info($"{plcClient.PLCName}AGV取消未执行任务").Write($"---------------结束记录,时间:{DateTime.Now}------------ {Environment.NewLine}", $"{plcClient.PLCName}AGV取消未执行任务");
|
return;
|
// throw new Exception(string.Format("给AGV写入任务异常确认0失败,任务号{0}", agvTask.agv_tasknum));
|
}
|
}
|
else
|
{
|
isTrue1 = true;
|
name1 = plcClient.PLCName;
|
////WriteLog.Info($"{plcClient.PLCName}AGV取消未执行任务").Write($"给AGV写入任务确认1失败,任务号{0},时间:" + DateTime.Now, $"{plcClient.PLCName}AGV取消未执行任务");
|
////WriteLog.Info($"{plcClient.PLCName}AGV取消未执行任务").Write($"---------------结束记录,时间:{DateTime.Now}------------ {Environment.NewLine}", $"{plcClient.PLCName}AGV取消未执行任务");
|
return;
|
}
|
|
}
|
}
|
else
|
{
|
////WriteLog.Info($"{plcClient.PLCName}AGV取消未执行任务").Write("AGV反馈的任务号" + result + "AGV任务队列中不存在,时间:" + DateTime.Now, $"{plcClient.PLCName}AGV取消未执行任务");
|
////WriteLog.Info($"{plcClient.PLCName}AGV取消未执行任务").Write($"---------------结束记录,时间:{DateTime.Now}------------{Environment.NewLine}", $"{plcClient.PLCName}AGV取消未执行任务");
|
return;
|
}
|
}
|
}
|
else
|
{
|
////WriteLog.Info($"{plcClient.PLCName}AGV取消未执行任务").Write($"---------------{plcClient.PLCName}断开连接 时间:{DateTime.Now} -------------- {Environment.NewLine}", $"{plcClient.PLCName}AGV取消未执行任务");
|
////WriteLog.Info($"{plcClient.PLCName}AGV取消未执行任务").Write($"---------------结束记录,时间:{DateTime.Now}------------ {Environment.NewLine}", $"{plcClient.PLCName}AGV取消未执行任务");
|
return;
|
}
|
|
|
|
}
|
}
|
else
|
{
|
bool taskInteractiveW2 = plcClient.WriteValue(TaskDBName.taskInteractiveW.ToString(), 0);
|
}
|
if (TaskInteractive == 11)
|
{
|
plcClient.WriteValue(TaskDBName.taskInteractiveW.ToString(), 0);
|
plcClient.WriteValue(TaskDBName.resetTaskInteractiveW.ToString(), 0);
|
}
|
//else if ( TaskInteractive==1 && TaskInteractiveW == 1)
|
// {
|
// isTrue1 = true;
|
// name1 = plcClient.PLCName;
|
// //写入WCS确认信号0
|
// //bool taskInteractiveW= plcClient.WriteValue(TaskDBName.taskInteractiveW.ToString(), 0);
|
// ////WriteLog.Info($"{plcClient.PLCName}SendAGVTask").Write($"写入 ,偏移值:DB1000.112,写入AGV信号:0,写入反馈结果:{taskInteractiveW},时间:{ DateTime.Now}", $"{plcClient.PLCName}SendAGVTask");
|
// ////WriteLog.Info($"{plcClient.PLCName}SendAGVTask").Write($"---------------结束记录,时间:{DateTime.Now}------------ {Environment.NewLine}", $"{plcClient.PLCName}SendAGVTask");
|
// return;
|
// }
|
//else if (TaskInteractive == 1 && TaskInteractiveW == 2)
|
// {
|
// isTrue1 = true;
|
// name1 = plcClient.PLCName;
|
// //写入WCS确认信号0
|
// //bool taskInteractiveW = plcClient.WriteValue(TaskDBName.taskInteractiveW.ToString(), 0);
|
|
// return;
|
// }
|
|
}
|
catch (Exception ex)
|
{
|
////WriteLog.Info($"{plcClient.PLCName}SendAGVTask").Write(ex.Message, $"{plcClient.PLCName}SendAGVTask");
|
}
|
finally
|
{
|
Interlocked.Exchange(ref _readSendAGVTaskSignalso, 0);
|
}
|
}
|
}
|
|
private static void updateloction(dt_agvtask aTask, Ibase_ware_locationRepository locationRepository, Idt_agvtaskRepository agvtaskRepository)
|
{
|
if (aTask != null)
|
{
|
if (aTask.agv_toaddress.Contains("HCJ") && aTask.agv_fromaddress.Contains("SB"))
|
{
|
if (aTask.agv_remark.Contains("辊分下料任务"))
|
{
|
if (aTask.agv_toaddress.Contains("ZJ-GFHCJ10-"))
|
{
|
string NUM = aTask.agv_toaddress.Remove(11) + "4";
|
base_ware_location location = locationRepository.FindFirst(x => x.upper_code == NUM);
|
if (location != null)
|
{
|
string lotionCode = aTask.agv_toaddress.Remove(11);
|
dt_agvtask Agvtask = agvtaskRepository.FindFirst(d => d.agv_tasknum != aTask.agv_tasknum && d.agv_toaddress.Contains(lotionCode));
|
if (Agvtask == null)
|
{
|
location.logic_col = 0;
|
location.logic_row = "0";
|
location.task = 2;
|
locationRepository.Update(location, x => new { x.logic_col, x.logic_row, x.task }, true);
|
}
|
}
|
}
|
else
|
{
|
string NUM = aTask.agv_toaddress.Remove(10) + "4";
|
base_ware_location location = locationRepository.FindFirst(x => x.upper_code == NUM);
|
if (location != null)
|
{
|
string lotionCode = aTask.agv_toaddress.Remove(10);
|
dt_agvtask Agvtask = agvtaskRepository.FindFirst(d => d.agv_tasknum != aTask.agv_tasknum && d.agv_toaddress.Contains(lotionCode));
|
if (Agvtask == null)
|
{
|
location.logic_col = 0;
|
location.logic_row = "0";
|
location.task = 2;
|
locationRepository.Update(location, x => new { x.logic_col, x.logic_row, x.task }, true);
|
}
|
}
|
}
|
|
}
|
else
|
{
|
base_ware_location location = locationRepository.FindFirst(x => x.upper_code == aTask.agv_toaddress);
|
location.logic_col = 0;
|
location.logic_row = "0";
|
location.task = 2;
|
locationRepository.Update(location, x => new { x.logic_col, x.logic_row, x.task }, true);
|
}
|
}
|
else if (aTask.agv_toaddress.Contains("SB") && aTask.agv_fromaddress.Contains("HCJ"))
|
{
|
base_ware_location location = locationRepository.FindFirst(x => x.upper_code == aTask.agv_fromaddress);
|
location.logic_col = 0;
|
location.logic_row = "0";
|
location.task = 2;
|
locationRepository.Update(location, x => new { x.logic_col, x.logic_row, x.task }, true);
|
}
|
else if (aTask.agv_toaddress.Contains("HCJ") && aTask.agv_fromaddress.Contains("HCJ"))
|
{
|
base_ware_location location = locationRepository.FindFirst(x => x.upper_code == aTask.agv_toaddress);
|
location.logic_col = 0;
|
location.logic_row = "0";
|
location.task = 2;
|
locationRepository.Update(location, x => new { x.logic_col, x.logic_row, x.task }, true);
|
|
base_ware_location location1 = locationRepository.FindFirst(x => x.upper_code == aTask.agv_fromaddress);
|
location1.logic_col = 0;
|
location1.logic_row = "0";
|
location1.task = 2;
|
var entry = locationRepository.DbContext.ChangeTracker.Entries<base_ware_location>().FirstOrDefault();
|
if (entry != null)
|
{
|
entry.State = EntityState.Detached;
|
}
|
int a = locationRepository.Update(location1, x => new { x.logic_col, x.logic_row, x.task }, true);
|
if (a != 1)
|
{
|
////WriteLog.Info("AGV任务反馈5").Write($"任务号:{aTask.agv_tasknum},起点地址:{aTask.agv_fromaddress},修改失败:{a},时间: {DateTime.Now}", "AGV任务反馈5");
|
}
|
}
|
}
|
|
|
}
|
|
|
}
|
}
|