| | |
| | | using System; |
| | | using System.Linq; |
| | | using System.Threading; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Common; |
| | | using WIDESEA_Common.DBHelper; |
| | | using WIDESEA_Common.LoctionEnum; |
| | |
| | | { |
| | | if (Interlocked.Exchange(ref _readZBCKSignalsoZ, 1) == 0) |
| | | { |
| | | |
| | | Task.Run(() => |
| | | { |
| | | try |
| | | { |
| | | FreeDB freeDB = new FreeDB(); |
| | |
| | | //34出口,供给辊分上料口 |
| | | var location_34 = freeDB.Select<base_ware_location>().Where(t => t.upper_code == "ZJ-BCHCJ32" && t.task == 2 && t.status == 1).First(); |
| | | //34空架立即补料 |
| | | if (location_34 != null) |
| | | dt_agvtask dt_Agvtask34 = agvRepository.FindFirst(x => x.agv_toaddress == "ZJ-BCHCJ32"); |
| | | if (dt_Agvtask34 != null && location_34.task == 2) |
| | | { |
| | | location_34.update_time = DateTime.Now; |
| | | location_34.task = 1; |
| | | location_34.logic_col = 1; |
| | | var entrys = locRepository.DbContext.ChangeTracker.Entries<base_ware_location>().FirstOrDefault(); |
| | | if (entrys != null) |
| | | { |
| | | entrys.State = EntityState.Detached; |
| | | } |
| | | int end = locRepository.Update(location_34, true); |
| | | } |
| | | if (location_34 != null && dt_Agvtask34 == null) |
| | | { |
| | | if (location_34.location_state == LoctionStateEnum.LocationState_Empty.ToString() && location_34.tpgd == 0) |
| | | { |
| | |
| | | |
| | | agvRepository.Add(agvtask, true); |
| | | |
| | | WriteDBLog.Info($"箔材库任务生成").Write($"生成任务:{agvtask.agv_tasknum}", $"箔材库任务生成"); |
| | | //WriteDBLog.Info($"箔材库任务生成").Write($"生成任务:{agvtask.agv_tasknum}", $"箔材库任务生成"); |
| | | |
| | | WriteDBLog.Info($"箔材库任务生成").Write($"起点货位【{location_34_cp.upper_code}】状态:托盘光电检测:{location_34_cp.tpgd},状态:{location_34_cp.location_state},更新时间:{location_34_cp.wireless_time}", $"箔材库任务生成"); |
| | | //WriteDBLog.Info($"箔材库任务生成").Write($"起点货位【{location_34_cp.upper_code}】状态:托盘光电检测:{location_34_cp.tpgd},状态:{location_34_cp.location_state},更新时间:{location_34_cp.wireless_time}", $"箔材库任务生成"); |
| | | |
| | | WriteDBLog.Info($"箔材库任务生成").Write($"终点货位【{location_34.upper_code}】状态:托盘光电检测:{location_34.tpgd},状态:{location_34.location_state},更新时间:{location_34.wireless_time}", $"箔材库任务生成"); |
| | | //WriteDBLog.Info($"箔材库任务生成").Write($"终点货位【{location_34.upper_code}】状态:托盘光电检测:{location_34.tpgd},状态:{location_34.location_state},更新时间:{location_34.wireless_time}", $"箔材库任务生成"); |
| | | |
| | | WriteDBLog.Info($"箔材库任务生成").Write($"----------------任务生成成功 {DateTime.Now} -------------- {Environment.NewLine}", $"箔材库任务生成"); |
| | | //WriteDBLog.Info($"箔材库任务生成").Write($"----------------任务生成成功 {DateTime.Now} -------------- {Environment.NewLine}", $"箔材库任务生成"); |
| | | } |
| | | } |
| | | |
| | |
| | | //36出口,供给涂布上料口 |
| | | var location_36 = freeDB.Select<base_ware_location>().Where(t => t.upper_code == "ZJ-BCHCJ34" && t.task == 2 && t.status == 1 ).First(); |
| | | //36空架立即补料 |
| | | if (location_36 != null) |
| | | dt_agvtask dt_Agvtask36 = agvRepository.FindFirst(x => x.agv_toaddress == "ZJ-BCHCJ34"); |
| | | if (dt_Agvtask36 != null && location_36.task == 2) |
| | | { |
| | | location_36.update_time = DateTime.Now; |
| | | location_36.task = 1; |
| | | location_36.logic_col = 1; |
| | | var entrys = locRepository.DbContext.ChangeTracker.Entries<base_ware_location>().FirstOrDefault(); |
| | | if (entrys != null) |
| | | { |
| | | entrys.State = EntityState.Detached; |
| | | } |
| | | int end = locRepository.Update(location_36, true); |
| | | } |
| | | if (location_36 != null && dt_Agvtask36==null) |
| | | { |
| | | if (location_36.location_state == LoctionStateEnum.LocationState_Empty.ToString() && location_36.tpgd == 0) |
| | | { |
| | |
| | | { |
| | | agvRepository.Add(agvtask, true); |
| | | |
| | | WriteDBLog.Info($"箔材库任务生成").Write($"生成任务:{agvtask.agv_tasknum}", $"箔材库任务生成"); |
| | | //WriteDBLog.Info($"箔材库任务生成").Write($"生成任务:{agvtask.agv_tasknum}", $"箔材库任务生成"); |
| | | |
| | | WriteDBLog.Info($"箔材库任务生成").Write($"起点货位【{location_36_cp.upper_code}】状态:托盘光电检测:{location_36_cp.tpgd},状态:{location_36_cp.location_state},更新时间:{location_36_cp.wireless_time}", $"箔材库任务生成"); |
| | | //WriteDBLog.Info($"箔材库任务生成").Write($"起点货位【{location_36_cp.upper_code}】状态:托盘光电检测:{location_36_cp.tpgd},状态:{location_36_cp.location_state},更新时间:{location_36_cp.wireless_time}", $"箔材库任务生成"); |
| | | |
| | | WriteDBLog.Info($"箔材库任务生成").Write($"终点货位【{location_36.upper_code}】状态:托盘光电检测:{location_36.tpgd},状态:{location_36.location_state},更新时间:{location_36.wireless_time}", $"箔材库任务生成"); |
| | | //WriteDBLog.Info($"箔材库任务生成").Write($"终点货位【{location_36.upper_code}】状态:托盘光电检测:{location_36.tpgd},状态:{location_36.location_state},更新时间:{location_36.wireless_time}", $"箔材库任务生成"); |
| | | |
| | | WriteDBLog.Info($"箔材库任务生成").Write($"----------------任务生成成功 {DateTime.Now} -------------- {Environment.NewLine}", $"箔材库任务生成"); |
| | | //WriteDBLog.Info($"箔材库任务生成").Write($"----------------任务生成成功 {DateTime.Now} -------------- {Environment.NewLine}", $"箔材库任务生成"); |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | agvRepository.Add(agvtask, true); |
| | | |
| | | WriteDBLog.Info($"箔材库任务生成").Write($"生成任务:{agvtask.agv_tasknum}", $"箔材库任务生成"); |
| | | //WriteDBLog.Info($"箔材库任务生成").Write($"生成任务:{agvtask.agv_tasknum}", $"箔材库任务生成"); |
| | | |
| | | WriteDBLog.Info($"箔材库任务生成").Write($"起点货位【{location_35.upper_code}】状态:托盘光电检测:{location_35.tpgd},状态:{location_35.location_state},更新时间:{location_35.wireless_time}", $"箔材库任务生成"); |
| | | //WriteDBLog.Info($"箔材库任务生成").Write($"起点货位【{location_35.upper_code}】状态:托盘光电检测:{location_35.tpgd},状态:{location_35.location_state},更新时间:{location_35.wireless_time}", $"箔材库任务生成"); |
| | | |
| | | WriteDBLog.Info($"箔材库任务生成").Write($"终点货位【{location_35_cp.upper_code}】状态:托盘光电检测:{location_35_cp.tpgd},状态:{location_35_cp.location_state},更新时间:{location_35_cp.wireless_time}", $"箔材库任务生成"); |
| | | //WriteDBLog.Info($"箔材库任务生成").Write($"终点货位【{location_35_cp.upper_code}】状态:托盘光电检测:{location_35_cp.tpgd},状态:{location_35_cp.location_state},更新时间:{location_35_cp.wireless_time}", $"箔材库任务生成"); |
| | | |
| | | WriteDBLog.Info($"箔材库任务生成").Write($"----------------任务生成成功 {DateTime.Now} -------------- {Environment.NewLine}", $"箔材库任务生成"); |
| | | //WriteDBLog.Info($"箔材库任务生成").Write($"----------------任务生成成功 {DateTime.Now} -------------- {Environment.NewLine}", $"箔材库任务生成"); |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | agvRepository.Add(agvtask, true); |
| | | |
| | | WriteDBLog.Info($"箔材库任务生成").Write($"生成任务:{agvtask.agv_tasknum}", $"箔材库任务生成"); |
| | | //WriteDBLog.Info($"箔材库任务生成").Write($"生成任务:{agvtask.agv_tasknum}", $"箔材库任务生成"); |
| | | |
| | | WriteDBLog.Info($"箔材库任务生成").Write($"起点货位【{location_37.upper_code}】状态:托盘光电检测:{location_37.tpgd},状态:{location_37.location_state},更新时间:{location_37.wireless_time}", $"箔材库任务生成"); |
| | | //WriteDBLog.Info($"箔材库任务生成").Write($"起点货位【{location_37.upper_code}】状态:托盘光电检测:{location_37.tpgd},状态:{location_37.location_state},更新时间:{location_37.wireless_time}", $"箔材库任务生成"); |
| | | |
| | | WriteDBLog.Info($"箔材库任务生成").Write($"终点货位【{location_37_cp.upper_code}】状态:托盘光电检测:{location_37_cp.tpgd},状态:{location_37_cp.location_state},更新时间:{location_37_cp.wireless_time}", $"箔材库任务生成"); |
| | | //WriteDBLog.Info($"箔材库任务生成").Write($"终点货位【{location_37_cp.upper_code}】状态:托盘光电检测:{location_37_cp.tpgd},状态:{location_37_cp.location_state},更新时间:{location_37_cp.wireless_time}", $"箔材库任务生成"); |
| | | |
| | | WriteDBLog.Info($"箔材库任务生成").Write($"----------------任务生成成功 {DateTime.Now} -------------- {Environment.NewLine}", $"箔材库任务生成"); |
| | | //WriteDBLog.Info($"箔材库任务生成").Write($"----------------任务生成成功 {DateTime.Now} -------------- {Environment.NewLine}", $"箔材库任务生成"); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | throw new Exception(ex.Message); |
| | | WriteLog.GetLog().Write($"箔材库任务生成:{DateTime.Now} --------------{ex}", $"箔材库任务生成"); |
| | | } |
| | | finally |
| | | { |
| | | |
| | | Interlocked.Exchange(ref _readZBCKSignalsoZ, 0); |
| | | } |
| | | }); |
| | | |
| | | } |
| | | } |
| | | |