From 0187d7d752ee493b3691432a24cf97ededda2530 Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期二, 24 三月 2026 08:48:40 +0800
Subject: [PATCH] 辊分下空筒、涂布上空筒,涂布缓存架存放空筒

---
 wcs-server-hbf/WIDESEA_WCS/SchedulerExecute/Equipment/F_GFSB_UPTask.cs |   56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 54 insertions(+), 2 deletions(-)

diff --git a/wcs-server-hbf/WIDESEA_WCS/SchedulerExecute/Equipment/F_GFSB_UPTask.cs b/wcs-server-hbf/WIDESEA_WCS/SchedulerExecute/Equipment/F_GFSB_UPTask.cs
index 8f55668..048d9b6 100644
--- a/wcs-server-hbf/WIDESEA_WCS/SchedulerExecute/Equipment/F_GFSB_UPTask.cs
+++ b/wcs-server-hbf/WIDESEA_WCS/SchedulerExecute/Equipment/F_GFSB_UPTask.cs
@@ -51,7 +51,59 @@
                             //褰撳墠璁惧鏈夋病鏈変笂鏂欒姹�
                             OperateResult<bool> GYR_RFX = plc.MelsecPLCClient.MelsecMcNetClient.ReadBool("D5493.0");
                             Int16 tf = Convert.ToInt16(GYR_RFX.Content);
-                            if (GYR_RFX.Content)
+                            OperateResult<Int16> R_Type = plc.MelsecPLCClient.MelsecMcNetClient.ReadInt16("D5424");
+                            if (GYR_RFX.Content && R_Type.Content==Convert.ToInt16(2))
+                            {
+                                //鏌ョ湅褰撳墠杈婂垎鏈鸿澶囨槸鍚︽湁AGV浠诲姟
+                                var SBtask = agvRepository.FindFirst(f => f.agv_fromaddress == plc.EquipType);
+                                //鏈夌粨鏉熸湰娆″惊鐜�
+                                if (SBtask != null) { continue; }
+                                #region 璁板綍涓嬬┖绛掕姹備俊鍙�
+                                WriteLog.GetLog().Write($"{plc.PLCName}涓嬬┖绛掕姹傦細{GYR_RFX.Content}锛寋R_Type.Content}---{DateTime.Now}", $"璐熸瀬妫嶅垎涓嬬┖绛掕姹�");
+                                #endregion
+                                List<base_routing_table> Routing_Table = routingRepository.Find(d => d.route_end == plc.EquipType);
+                                List<string> begans = Routing_Table.Select(x=>x.route_began).ToList();
+                                base_ware_location ware_Location = locRepository.Find(d => begans.Contains(d.upper_code) && d.location_state == LoctionStateEnum.LocationState_Empty.ToString() && d.tpgd == 0 && d.area == "FJ-TBHCJ" && d.status == 1 && d.task == 2 && d.geartype == "C").OrderBy(d => d.update_time).FirstOrDefault();
+
+                                if (ware_Location != null)
+                                {
+                                    base_ware_location Location = ware_Location;
+                                    //鐢熸垚娑傚竷鏈轰笅鏂欎换鍔�
+                                    dt_agvtask agvtask = new dt_agvtask()
+                                    {
+                                        agv_id = Guid.NewGuid(),
+                                        agv_tasknum = "KH-" + IdenxManager.GetTaskNo(),
+                                        agv_fromaddress = plc.EquipType,//浠ヨ澶囦负璧风偣
+                                        agv_toaddress = Location.upper_code,
+                                        agv_code = "璐熸瀬AGV璋冨害",
+                                        agv_remark = "杈婂垎涓嬬┖绛掍换鍔�",
+                                        agv_taskstate = AGVTaskStateEnum.Create.ToString(),
+                                        agv_tasktype = AGVTaskTypeEnum.TaskType_Outbound.ToString(),
+                                        agv_worktype = 1,//宸ヤ綔绫诲瀷
+                                        agv_materielid = "",
+                                        agv_qty = 1,
+                                        agv_createtime = DateTime.Now,
+                                        agv_grade = 0,//浠诲姟浼樺厛绾�
+                                        agv_userid = "WCS",
+                                        agv_barcode = "",
+                                    };
+
+                                    //Location.update_time = DateTime.Now;
+                                    Location.update_time = DateTime.Now;
+                                    Location.task = 1;
+                                    var entry = locRepository.DbContext.ChangeTracker.Entries<base_ware_location>().FirstOrDefault();
+                                    if (entry != null)
+                                    {
+                                        entry.State = EntityState.Detached;
+                                    }
+                                    int a = locRepository.Update(Location, d => new { d.task, d.update_time }, true);
+                                    if (a == 1)
+                                    {
+                                        agvRepository.Add(agvtask, true);
+                                    }
+                                }
+                            }
+                            else if(GYR_RFX.Content)
                             {
                                 //鏌ョ湅褰撳墠杈婂垎鏈鸿澶囨槸鍚︽湁AGV浠诲姟
                                 var SBtask = agvRepository.FindFirst(f => f.agv_toaddress == plc.EquipType);
@@ -64,7 +116,7 @@
                                 List<base_ware_location> loctionList = new List<base_ware_location>();
                                 foreach (var item in Routing_Table)
                                 {
-                                    base_ware_location ware_Locations = locRepository.FindFirst(d => d.upper_code == item.route_began && d.status == 1 && d.location_state == LoctionStateEnum.LocationState_Stored.ToString() && d.logic_col == 1 && d.task == 2);
+                                    base_ware_location ware_Locations = locRepository.FindFirst(d => d.upper_code == item.route_began && d.status == 1 && d.location_state == LoctionStateEnum.LocationState_Stored.ToString() && d.logic_col == 1 && d.task == 2 && d.geartype == "鏆傛棤");
                                     if (ware_Locations == null)
                                     {
                                         continue;

--
Gitblit v1.9.3