wangxinhui
2024-12-26 78b99e5348592a29ca1393a5e13db619cc4eba56
wcs-server-hbf/WIDESEA_WCS/JobsPart/AGV/UpdateAgvTaskText.cs
@@ -211,6 +211,20 @@
                                    WriteLog.GetLog().Write($"任务号:{agvTask.agv_tasknum},内容:终点地址:{dt_Stationinfo.stationCode},货位修改失败", $"货位修改失败");
                                }
                            }
                            else if (agvTask.agv_remark.Contains("入壳上料任务"))
                            {
                                dt_stationinfo dt_Stationinfo = stationinfoRepository.FindFirst(d => d.stationCode == agvTask.agv_fromaddress);
                                if (dt_Stationinfo == null)
                                {
                                    return;
                                }
                                dt_Stationinfo.task = false;
                                int a = stationinfoRepository.Update(dt_Stationinfo, x => new { x.task }, true);
                                if (a == 0)
                                {
                                    WriteLog.GetLog().Write($"任务号:{agvTask.agv_tasknum},内容:终点地址:{dt_Stationinfo.stationCode},货位修改失败", $"货位修改失败");
                                }
                            }
                            #endregion
                            plcClient.WriteValue(TaskDBName.taskFbInteractiveW.ToString(), 1);
                            for (int i = 0; i < 5; i++)
@@ -276,19 +290,22 @@
                                if (agvTask.agv_fromaddress.Contains("HCJ"))
                                {
                                    base_ware_location location = locationRepository.FindFirst(x => x.upper_code == agvTask.agv_fromaddress);
                                    if (!agvTask.agv_remark.Contains("切卷上料回空"))
                                    if (location != null)
                                    {
                                        location.geartype = "暂无";
                                    }
                                    location.update_time = DateTime.Now;
                                    location.logic_col = 0;
                                    location.task = 2;
                                    location.logic_row = "0";
                                        if (!agvTask.agv_remark.Contains("切卷上料回空"))
                                        {
                                            location.geartype = "暂无";
                                        }
                                        location.update_time = DateTime.Now;
                                        location.logic_col = 0;
                                        location.task = 2;
                                        location.logic_row = "0";
                                    int a = locationRepository.Update(location, x => new { x.logic_col, x.task, x.logic_row, x.update_time, x.geartype }, true);
                                    if (a == 0)
                                    {
                                        WriteLog.GetLog().Write($"任务号:{agvTask.agv_tasknum},内容:终点地址:{location.upper_code},货位修改失败", $"货位修改失败");
                                        int a = locationRepository.Update(location, x => new { x.logic_col, x.task, x.logic_row, x.update_time, x.geartype }, true);
                                        if (a == 0)
                                        {
                                            WriteLog.GetLog().Write($"任务号:{agvTask.agv_tasknum},内容:终点地址:{location.upper_code},货位修改失败", $"货位修改失败");
                                        }
                                    }
                                }
                            }
@@ -583,6 +600,20 @@
                                }
                            }
                            else if (agvTask.agv_remark.Contains("入壳下料任务"))
                            {
                                dt_stationinfo dt_Stationinfo = stationinfoRepository.FindFirst(d => d.stationCode == agvTask.agv_toaddress);
                                if (dt_Stationinfo == null)
                                {
                                    return;
                                }
                                dt_Stationinfo.task = false;
                                int a = stationinfoRepository.Update(dt_Stationinfo, x => new { x.task }, true);
                                if (a == 0)
                                {
                                    WriteLog.GetLog().Write($"任务号:{agvTask.agv_tasknum},内容:终点地址:{dt_Stationinfo.stationCode},货位修改失败", $"货位修改失败");
                                }
                            }
                            #endregion
                            plcClient.WriteValue(TaskDBName.taskFbInteractiveW.ToString(), 1);
                            for (int i = 0; i < 5; i++)
@@ -691,22 +722,57 @@
                                }
                            }
                            else if (agvTask.agv_remark.Contains("入壳下料任务"))
                            {
                                dt_stationinfo dt_Stationinfo = stationinfoRepository.FindFirst(d => d.stationCode == agvTask.agv_toaddress);
                                if (dt_Stationinfo != null)
                                {
                                    dt_Stationinfo.task = false;
                                    int a = stationinfoRepository.Update(dt_Stationinfo, x => new { x.task }, true);
                                    if (a == 0)
                                    {
                                        WriteLog.GetLog().Write($"任务号:{agvTask.agv_tasknum},内容:终点地址:{dt_Stationinfo.stationCode},货位修改失败", $"货位修改失败");
                                    }
                                }
                            }
                            else
                            {
                                base_ware_location location = locationRepository.FindFirst(x => x.upper_code == agvTask.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);
                                if (location!=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 if (agvTask.agv_toaddress.Contains("SB") && agvTask.agv_fromaddress.Contains("HCJ"))
                        {
                            base_ware_location location = locationRepository.FindFirst(x => x.upper_code == agvTask.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);
                            if (agvTask.agv_remark.Contains("入壳上料任务"))
                            {
                                dt_stationinfo dt_Stationinfo = stationinfoRepository.FindFirst(d => d.stationCode == agvTask.agv_fromaddress);
                                if (dt_Stationinfo != null)
                                {
                                    dt_Stationinfo.task = false;
                                    int a = stationinfoRepository.Update(dt_Stationinfo, x => new { x.task }, true);
                                    if (a == 0)
                                    {
                                        WriteLog.GetLog().Write($"任务号:{agvTask.agv_tasknum},内容:终点地址:{dt_Stationinfo.stationCode},货位修改失败", $"货位修改失败");
                                    }
                                }
                            }
                            else
                            {
                                base_ware_location location = locationRepository.FindFirst(x => x.upper_code == agvTask.agv_fromaddress);
                                if (location != 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 if (agvTask.agv_toaddress.Contains("HCJ") && agvTask.agv_fromaddress.Contains("HCJ"))
                        {