From 96f8b9f0629b3e4697269f0c271b43ad165f71b0 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期三, 24 四月 2024 10:13:52 +0800
Subject: [PATCH] 优化机加工下料任务逻辑
---
代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/EmptyTrayTask.cs | 58 +++++++++++++++++++++++++++++++++++++++++++---------------
1 files changed, 43 insertions(+), 15 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/EmptyTrayTask.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/EmptyTrayTask.cs"
index d7e67a8..196578d 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/EmptyTrayTask.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/EmptyTrayTask.cs"
@@ -48,7 +48,7 @@
agv_fromaddress = "",
agv_id = Guid.NewGuid(),
agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"),
- agv_grade = 2,
+ agv_grade = station.stationCode.Contains("W0100100") ? 3 : 2,
agv_createtime = DateTime.Now,
agv_taskstate = "Queue",
agv_qty = 1,
@@ -81,41 +81,69 @@
VOLContext context = new VOLContext();
Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(context);
Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(context);
- var stations = stationinfoRepository.Find(x => x.area == "2" && x.enable && x.location_state == LocationStateEnum.Empty.ToString()).OrderBy(x => x.line).OrderBy(x => x.column).ToList();
- if (stations.Count < 1)
- {
- stations = stationinfoRepository.Find(x => x.area == "3" && x.enable && x.location_state == LocationStateEnum.Empty.ToString()).OrderBy(x => x.line).OrderBy(x => x.column).ToList();
- }
+ var stations = stationinfoRepository.Find(x => x.stationCode.Contains("C01004") && x.enable && x.location_state == LocationStateEnum.Stroge.ToString()).OrderByDescending(x => x.column).ToList();
+ //if (stations.Count < 1)
+ //{
+ // stations = stationinfoRepository.Find(x => x.area == "3" && x.enable && x.location_state == LocationStateEnum.Empty.ToString()).OrderBy(x => x.line).OrderBy(x => x.column).ToList();
+ //}
foreach (var station in stations)
{
- if (agvtaskRepository.Find(x => x.agv_toaddress == station.stationCode).Any())
+ if (agvtaskRepository.Find(x => x.agv_fromaddress == station.stationCode).Any())
continue;
dt_agvtask taskPart = new dt_agvtask()
{
- agv_fromaddress = "",
+ agv_fromaddress = station.stationCode,
agv_id = Guid.NewGuid(),
agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"),
- agv_grade = 2,
+ agv_grade = 1,
agv_createtime = DateTime.Now,
agv_taskstate = "Queue",
+ //agv_materielid = station.stationType,
agv_qty = 1,
+ StarQuantity = 0,
+ EndQuantity = 0,// EmptyStation.quantity,
agv_tasktype = "TaskType_EmptyPallet",
- agv_toaddress = station.stationCode,
+ agv_toaddress = "",// EmptyStation.stationCode,
agv_userid = "绯荤粺",
- agv_TrayStatus = "EmptyTray",// station.tray_status, "SmallTray" : "LargeTray"
- agv_Traytype = station.area == "4" ? "LargeTray" : "SmallTray",
+ agv_TrayStatus = "EmptyTray",//station.tray_status,
+ agv_Traytype = station.tray_type,
};
agvtaskRepository.Add(taskPart, true);
- station.location_state = LocationStateEnum.InBusy.ToString();
+ station.location_state = LocationStateEnum.OutBusy.ToString();
stationinfoRepository.Update(station, true);
- WriteDBLog.Success("鍒涘缓琛ュ簱鍐呯┖鎵樹换鍔�", $"浠诲姟缂栧彿锛歿taskPart.agv_tasknum}", "PCS");
+ //WriteDBLog.Success("鍒涘缓绌烘墭浠诲姟", $"浠诲姟缂栧彿锛歿taskPart.agv_tasknum}", "PCS");
}
}
catch (Exception ex)
{
- WriteDBLog.Error("鍒涘缓琛ュ簱鍐呯┖鎵樹换鍔�", $"閿欒淇℃伅锛歿ex.Message}", "PCS");
+ //WriteDBLog.Error("鍒涘缓琛ュ簱鍐呯┖鎵樹换鍔�", $"閿欒淇℃伅锛歿ex.Message}", "PCS");
//throw;
}
}
+ public static void task()
+ {
+ VOLContext context = new VOLContext();
+ Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(context);
+ Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(context);
+ var tasks = agvtaskRepository.Find(x => x.agv_taskstate == "Queue").OrderBy(x => x.agv_createtime).ToList();
+ foreach (var task in tasks)
+ {
+ if (task.agv_tasktype == "TaskType_EmptyPallet")
+ {
+ if (task.agv_toaddress == "")
+ {
+ var EmptyStation = stationinfoRepository.Find(x => x.area == "11" && x.stationCode.Contains("A") && x.quantity < 5 && x.enable).OrderByDescending(x => x.line).OrderBy(x => x.column).FirstOrDefault();
+ if (EmptyStation == null) return;
+ if (EmptyStation.location_state == LocationStateEnum.Busy.ToString()) return;
+ task.agv_toaddress = EmptyStation.stationCode;
+ task.EndQuantity = EmptyStation.quantity;
+ task.agv_taskstate = "Create";
+ EmptyStation.location_state = LocationStateEnum.Busy.ToString();
+ stationinfoRepository.Update(EmptyStation, true);
+ agvtaskRepository.Update(task, true);
+ }
+ }
+ }
+ }
}
}
--
Gitblit v1.9.3