From cfea43fe783cdb99faa14f59845e41cfcda7d974 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期四, 16 五月 2024 17:22:48 +0800
Subject: [PATCH] AGV任务删除功能,取空托任务逻辑优化,检测上料任务下发逻辑优化(AGV备料两个)
---
代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/RestockHCJ.cs | 7
代码管理/PCS/WCS_Server/WIDESEA_WCS/Jobs/Task/AutoTaskJob.cs | 2
代码管理/WMS/WMS_Server/WIDESEA_WebApi/Controllers/JobTask.cs | 1
代码管理/WMS/WMS_Server/WIDESEA_WMS/Common/GetStation/EmptyTrayIn.cs | 90 ++++++
代码管理/PCS/WCS_Server/WIDESEA_WCS/Common/Pipeline.cs | 172 +++++++-----
代码管理/WMS/WMS_Server/WIDESEA_WMS/Common/GetStation/EmptyPalletStation.cs | 204 ++++++++++++++
代码管理/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/EmptyPalletTask.cs | 95 ++++++
代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/ReplaceTray.cs | 97 ++++--
代码管理/WMS/WMS_Server/WIDESEA_WMS/Services/Taskinfo/Partial/dt_agvtaskService.cs | 61 ++++
代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/EmptyTrayTask.cs | 52 ++-
代码管理/WMS/WMS_Server/WIDESEA_Comm/StateEnum/TrayEnum.cs | 38 ++
11 files changed, 685 insertions(+), 134 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Common/Pipeline.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Common/Pipeline.cs"
index 22961fb..bff502d 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Common/Pipeline.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Common/Pipeline.cs"
@@ -16,6 +16,7 @@
using WIDESEA_Comm.TaskNo;
using WIDESEA_WCS.JobsPart.Common;
using System.Xml.Linq;
+using WIDESEA_Common;
namespace WIDESEA_WCS
{
@@ -84,9 +85,9 @@
{
#region 鍒ゆ柇鍖哄煙鍙锋槸鍚︿竴鑷�
- var area = Gantry_client.ReadByOrder<Int16>("place_prog", number);//鏀炬枡瀹屾垚鐨勫尯鍩熷彿
+ //var area = Gantry_client.ReadByOrder<Int16>("place_prog", number);//鏀炬枡瀹屾垚鐨勫尯鍩熷彿
- WriteLog.Write_Log(number + "鍙栨枡瀹屾垚鍑洪敊", bindSNS[bindSNS.Length - 1], "鍒ゆ柇鍖哄煙鍙锋槸鍚︿竴鑷�", $"PCS鍖哄煙鍙凤細{AreaNr}锛沑n妗佹灦鍖哄煙鍙凤細{area}\n閿欒淇℃伅锛歅CS鍖哄煙鍙蜂笌妗佹灦鍖哄煙鍙蜂笉涓�鑷达紒");
+ //WriteLog.Write_Log(number + "鍙栨枡瀹屾垚鍑洪敊", bindSNS[bindSNS.Length - 1], "鍒ゆ柇鍖哄煙鍙锋槸鍚︿竴鑷�", $"PCS鍖哄煙鍙凤細{AreaNr}锛沑n妗佹灦鍖哄煙鍙凤細{area}\n閿欒淇℃伅锛歅CS鍖哄煙鍙蜂笌妗佹灦鍖哄煙鍙蜂笉涓�鑷达紒");
//if (AreaNr != area)
//{
// client.WriteByOrder("W_AlarmSignal", (Int16)2, number);//鎶ヨ
@@ -97,9 +98,9 @@
#endregion
#region 鍒ゆ柇杞﹁疆鏁伴噺鏄惁涓�鑷�
- var quantity = Gantry_client.ReadByOrder<Int16>("pos_prog", number);//妗佹灦璁板綍鐨勮溅杞暟閲�
+ //var quantity = Gantry_client.ReadByOrder<Int16>("pos_prog", number);//妗佹灦璁板綍鐨勮溅杞暟閲�
- WriteLog.Write_Log(number + "鍙栨枡瀹屾垚鍑洪敊", bindSNS[bindSNS.Length - 1], "鍒ゆ柇杞﹁疆鏁伴噺鏄惁涓�鑷�", $"鍖哄煙鍙凤細{AreaNr}锛沑n妗佹灦杞﹁疆鏁帮細{quantity}\nPCS杞﹁疆鏁帮細{station.quantity}\n閿欒淇℃伅锛歅CS鍖哄煙鍙蜂笌妗佹灦鍖哄煙鍙蜂笉涓�鑷达紒");
+ //WriteLog.Write_Log(number + "鍙栨枡瀹屾垚鍑洪敊", bindSNS[bindSNS.Length - 1], "鍒ゆ柇杞﹁疆鏁伴噺鏄惁涓�鑷�", $"鍖哄煙鍙凤細{AreaNr}锛沑n妗佹灦杞﹁疆鏁帮細{quantity}\nPCS杞﹁疆鏁帮細{station.quantity}\n閿欒淇℃伅锛歅CS鍖哄煙鍙蜂笌妗佹灦鍖哄煙鍙蜂笉涓�鑷达紒");
//if (quantity != station.quantity)
//{
// client.WriteByOrder("W_AlarmSignal", (Int16)2, number);//鎶ヨ
@@ -196,18 +197,18 @@
}
#region 鏇存柊涓�涓娴嬩笂鏂欎换鍔�
- Idt_agvtaskRepository agvtaskService = new dt_agvtaskRepository(Context);
- if (!agvtaskService.Find(x => x.agv_toaddress == Station.stationCode).Any())
- {
- var task = agvtaskService.Find(x => x.agv_taskstate == "Queue" && (x.agv_tasktype == "TaskType_OutsourceOutbound" || x.agv_tasktype == "TaskType_Outbound") && x.agv_toaddress == "").OrderByDescending(x => x.agv_grade).ThenBy(x => x.agv_createtime).FirstOrDefault();
- if (task != null)
- {
- task.agv_taskstate = "Create";
- task.agv_toaddress = Station.stationCode;
- agvtaskService.Update(task, true);
- WriteDBLog.Success("鏇存柊涓�涓娴嬩笂鏂欎换鍔�", $"浠诲姟缂栧彿锛歿task.agv_tasknum}", "PCS");
- }
- }
+ //Idt_agvtaskRepository agvtaskService = new dt_agvtaskRepository(Context);
+ //if (!agvtaskService.Find(x => x.agv_toaddress == Station.stationCode).Any())
+ //{
+ // var task = agvtaskService.Find(x => x.agv_taskstate == "Queue" && (x.agv_tasktype == "TaskType_OutsourceOutbound" || x.agv_tasktype == "TaskType_Outbound") && x.agv_toaddress == "").OrderByDescending(x => x.agv_grade).ThenBy(x => x.agv_createtime).FirstOrDefault();
+ // if (task != null)
+ // {
+ // task.agv_taskstate = "Create";
+ // task.agv_toaddress = Station.stationCode;
+ // agvtaskService.Update(task, true);
+ // WriteDBLog.Success("鏇存柊涓�涓娴嬩笂鏂欎换鍔�", $"浠诲姟缂栧彿锛歿task.agv_tasknum}", "PCS");
+ // }
+ //}
#endregion
}
}
@@ -411,78 +412,105 @@
agvtaskService.Update(task, true);
station.location_state = LocationStateEnum.Busy.ToString();
stationinfoRepository.Update(station, true);
- WriteDBLog.Success("鏇存柊绌烘墭闃熷垪浠诲姟", $"浠诲姟缂栧彿锛歿task.agv_tasknum}锛屾墭鐩樹俊鍙�:{PalletSignal},璐х墿淇″彿:{MaterialSignal}", "PCS");
+ WriteDBLog.Success("鏇存柊琛ョ┖鎵橀槦鍒椾换鍔�", $"浠诲姟缂栧彿锛歿task.agv_tasknum}锛屾墭鐩樹俊鍙�:{PalletSignal},璐х墿淇″彿:{MaterialSignal}", "PCS");
continue;
}
- remark = "鏌ヨ绌烘墭鍙犵洏浣�";
- #region 绌烘墭鍙犵洏
- if (stationCode.Contains("S"))
- {
- var EmptyStations = stationinfoRepository.Find(x => x.stationCode.Contains("DD") && x.quantity < 5 && x.enable).ToList();
- EmptyStation = EmptyStations.Where(x => x.tray_type == station.tray_type && x.location_state == LocationStateEnum.Stroge.ToString()).FirstOrDefault();
- if (EmptyStation == null)
- EmptyStation = EmptyStations.Where(x => x.location_state == LocationStateEnum.Empty.ToString() && x.quantity == 0 && x.enable).FirstOrDefault();
- if (EmptyStation == null)
- {
- EmptyStation = EmptyStations.Where(x => x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0 && x.enable).OrderByDescending(x => x.quantity).FirstOrDefault();
- if (EmptyStation != null) EmptyTray.CreateEmptyTrayIn(stationinfoRepository, EmptyStation);
- }
- }
+ #region 妫�娴嬩笂鏂欑殑绌烘墭鍙犵洏
+ //remark = "鏌ヨ绌烘墭鍙犵洏浣�";
+ //var EmptyStations = stationinfoRepository.Find(x => x.stationCode.Contains("DD") && x.enable).ToList();
+ //if (stationCode.Contains("S"))
+ //{
+ // //var EmptyStations = stationinfoRepository.Find(x => x.stationCode.Contains("DD") && x.quantity < 5 && x.enable).ToList();
+ // EmptyStation = EmptyStations.Where(x => x.tray_type == station.tray_type && x.quantity < 5 && x.location_state == LocationStateEnum.Stroge.ToString()).FirstOrDefault();
+ // if (EmptyStation == null)
+ // EmptyStation = EmptyStations.Where(x => x.location_state == LocationStateEnum.Empty.ToString() && x.quantity == 0).FirstOrDefault();
+ // if (EmptyStation == null)
+ // {
+ // EmptyStation = EmptyStations.Where(x => x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).OrderByDescending(x => x.quantity).FirstOrDefault();
+ // if (EmptyStation != null) EmptyTray.CreateEmptyTrayIn(stationinfoRepository, EmptyStation);
+ // }
+ //}
+ //EmptyStation = EmptyStations.Where(x => x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity == 5).FirstOrDefault();
+ //if (EmptyStation != null) EmptyTray.CreateEmptyTrayIn(stationinfoRepository, EmptyStation);
#endregion
- else
+
+ #region 鍒涘缓鍙栫┖鎵橀槦鍒椾换鍔�
+ dt_agvtask agvtask = new dt_agvtask()
{
- remark = "鏌ユ壘搴撳唴绌烘墭浣�";
- EmptyStation = GetStation.EmptyPalletStation(area);
- if (EmptyStation != null)
- if (agvtaskService.Find(x => x.agv_fromaddress == EmptyStation.stationCode || x.agv_toaddress == EmptyStation.stationCode).Any()) return;
- }
+ agv_fromaddress = station.stationCode,
+ agv_id = Guid.NewGuid(),
+ agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"),
+ agv_grade = station.stationCode.Contains("S0100100") ? 3 : 1,
+ agv_createtime = DateTime.Now,
+ agv_taskstate = AGVTaskStateEnum.Queue.ToString(),
+ //agv_materielid = station.stationType,
+ agv_qty = 1,
+ StarQuantity = 0,
+ EndQuantity = 0,//EmptyStation.quantity,
+ agv_tasktype = AGVTaskTypeEnum.TaskType_EmptyPallet.ToString(),
+ agv_toaddress = "",//EmptyStation.stationCode,
+ agv_userid = "绯荤粺",
+ agv_TrayStatus = "EmptyTray",//station.tray_status,
+ agv_Traytype = station.tray_type,
+ };
+ agvtaskService.Add(agvtask, true);
+ station.location_state = LocationStateEnum.Busy.ToString();
+ stationinfoRepository.Update(station, true);
+ //EmptyStation.location_state = LocationStateEnum.Busy.ToString();
+ //stationinfoRepository.Update(EmptyStation, true);
+ WriteDBLog.Success("鍒涘缓鑷姩鍙栫┖鎵橀槦鍒椾换鍔�", $"浠诲姟缂栧彿锛歿agvtask.agv_tasknum}锛屾墭鐩樹俊鍙�:{PalletSignal},璐х墿淇″彿:{MaterialSignal}", "PCS");
+ #endregion
+
+ #region 鍒涘缓鍙栫┖鎵樻柊寤轰换鍔�
+ //else
+ //{
+ // remark = "鏌ユ壘搴撳唴绌烘墭浣�";
+ // EmptyStation = GetStation.EmptyPalletStation(area);
+ // if (EmptyStation != null)
+ // if (agvtaskService.Find(x => x.agv_fromaddress == EmptyStation.stationCode || x.agv_toaddress == EmptyStation.stationCode).Any()) return;
+ //}
- if (EmptyStation != null)
- {
- #region 鍚屼竴涓┖鎵樹綅鍙兘鍚屾椂鐢熸垚涓�涓┖鎵樹换鍔�
- //remark = "鏌ヨ绌烘墭浣嶆槸鍚﹀瓨鍦ㄤ换鍔�";
- //if (agvtaskService.Find(x => x.agv_fromaddress == EmptyStation.stationCode || x.agv_toaddress == EmptyStation.stationCode).Any())
- // return;
- #endregion
- dt_agvtask agvtask = new dt_agvtask()
- {
- agv_fromaddress = station.stationCode,
- agv_id = Guid.NewGuid(),
- agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"),
- agv_grade = station.stationCode.Contains("S0100100") ? 3 : 1,
- agv_createtime = DateTime.Now,
- agv_taskstate = "Create",
- //agv_materielid = station.stationType,
- agv_qty = 1,
- StarQuantity = 0,
- EndQuantity = EmptyStation.quantity,
- agv_tasktype = "TaskType_EmptyPallet",
- agv_toaddress = EmptyStation.stationCode,
- agv_userid = "绯荤粺",
- agv_TrayStatus = "EmptyTray",//station.tray_status,
- agv_Traytype = station.tray_type,
- };
- agvtaskService.Add(agvtask, true);
- station.location_state = LocationStateEnum.Busy.ToString();
- stationinfoRepository.Update(station, true);
- EmptyStation.location_state = LocationStateEnum.Busy.ToString();
- stationinfoRepository.Update(EmptyStation, true);
- WriteDBLog.Success("鍒涘缓鑷姩鍙栫┖鎵樹换鍔�", $"浠诲姟缂栧彿锛歿agvtask.agv_tasknum}锛屾墭鐩樹俊鍙�:{PalletSignal},璐х墿淇″彿:{MaterialSignal}", "PCS");
- }
+ //if (EmptyStation != null)
+ //{
+ // dt_agvtask agvtask = new dt_agvtask()
+ // {
+ // agv_fromaddress = station.stationCode,
+ // agv_id = Guid.NewGuid(),
+ // agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"),
+ // agv_grade = station.stationCode.Contains("S0100100") ? 3 : 1,
+ // agv_createtime = DateTime.Now,
+ // agv_taskstate = AGVTaskStateEnum.Create.ToString(),
+ // //agv_materielid = station.stationType,
+ // agv_qty = 1,
+ // StarQuantity = 0,
+ // EndQuantity = EmptyStation.quantity,
+ // agv_tasktype = "TaskType_EmptyPallet",
+ // agv_toaddress = EmptyStation.stationCode,
+ // agv_userid = "绯荤粺",
+ // agv_TrayStatus = "EmptyTray",//station.tray_status,
+ // agv_Traytype = station.tray_type,
+ // };
+ // agvtaskService.Add(agvtask, true);
+ // station.location_state = LocationStateEnum.Busy.ToString();
+ // stationinfoRepository.Update(station, true);
+ // EmptyStation.location_state = LocationStateEnum.Busy.ToString();
+ // stationinfoRepository.Update(EmptyStation, true);
+ // WriteDBLog.Success("鍒涘缓鑷姩鍙栫┖鎵樹换鍔�", $"浠诲姟缂栧彿锛歿agvtask.agv_tasknum}锛屾墭鐩樹俊鍙�:{PalletSignal},璐х墿淇″彿:{MaterialSignal}", "PCS");
+ //}
+ #endregion
}
}
catch (Exception ex)
{
- //WriteDBLog.Error("鍒涘缓鑷姩鍙栫┖鎵樹换鍔�", $"{stationCode}锛歿remark}閿欒淇℃伅锛歿ex.Message}", "PCS");
- WriteLog.Write_Log("鎶ラ敊鏃ュ織", "鍒涘缓鑷姩鍙栫┖鎵樹换鍔�", "閿欒淇℃伅锛�", $"{stationCode}锛歿remark}閿欒淇℃伅锛歿ex.Message}");
+ WriteLog.Write_Log("鎶ラ敊鏃ュ織", "鍒涘缓鑷姩鍙栫┖鎵橀槦鍒椾换鍔�", "閿欒淇℃伅锛�", $"{stationCode}锛歿remark}閿欒淇℃伅锛歿ex.Message}");
}
}
}
catch (Exception ex)
{
//WriteDBLog.Error("鍒涘缓鑷姩鍙栫┖鎵樹换鍔�", $"閿欒淇℃伅锛歿ex.Message}", "PCS");
- WriteLog.Write_Log("鎶ラ敊鏃ュ織", "鍒涘缓鑷姩鍙栫┖鎵樹换鍔�", "閿欒淇℃伅锛�", $"閿欒淇℃伅锛歿ex.Message}");
+ WriteLog.Write_Log("鎶ラ敊鏃ュ織", "鍒涘缓鑷姩鍙栫┖鎵橀槦鍒椾换鍔�", "閿欒淇℃伅锛�", $"閿欒淇℃伅锛歿ex.Message}");
}
}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/Task/AutoTaskJob.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/Task/AutoTaskJob.cs"
index 2a95776..d3978c3 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/Task/AutoTaskJob.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/Task/AutoTaskJob.cs"
@@ -30,7 +30,7 @@
private void DoAction(IJobExecutionContext context)
{
- EmptyTray.EmptyTrayIn();//绌烘墭鍙犵洏鍏ュ簱
+ //EmptyTray.EmptyTrayIn();//绌烘墭鍙犵洏鍏ュ簱
StationTask.CreateTask();//鍏ュ簱
OutboundTask.CreateOutboundTask();//鍑哄簱
ReplaceTray.ReplaceTrayTask();//鏇存崲鎵樼洏
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 196578d..c67fabd 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"
@@ -6,6 +6,7 @@
using WIDESEA_Comm;
using WIDESEA_Comm.LogInfo;
using WIDESEA_Comm.TaskNo;
+using WIDESEA_Common;
using WIDESEA_Core.EFDbContext;
using WIDESEA_Entity.DomainModels;
using WIDESEA_WCS.IRepositories;
@@ -43,25 +44,40 @@
var MaterialSignal = Pipeline_client.ReadByOrder<Int16>("R_MaterialSignal", station.stationCode);//璇诲彇璐х墿淇″彿:1:鏈�,2鏃�
if (PalletSignal == 2 && MaterialSignal == 2)
{
- dt_agvtask taskPart = new dt_agvtask()
+ var agv_task = agvtaskRepository.Find(x => x.agv_taskstate == AGVTaskStateEnum.Queue.ToString() && x.agv_tasktype == AGVTaskTypeEnum.TaskType_EmptyPallet.ToString() && string.IsNullOrEmpty(x.agv_toaddress)).OrderByDescending(x => x.agv_grade).ThenBy(x => x.agv_createtime).FirstOrDefault();
+ if (agv_task != null)
{
- agv_fromaddress = "",
- agv_id = Guid.NewGuid(),
- agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"),
- agv_grade = station.stationCode.Contains("W0100100") ? 3 : 2,
- agv_createtime = DateTime.Now,
- agv_taskstate = "Queue",
- agv_qty = 1,
- agv_tasktype = "TaskType_EmptyPallet",
- agv_toaddress = station.stationCode,
- agv_userid = "绯荤粺",
- agv_TrayStatus = "EmptyTray",// station.tray_status,
- agv_Traytype = station.tray_type
- };
- station.location_state = LocationStateEnum.Busy.ToString();
- stationinfoRepository.Update(station, true);
- agvtaskRepository.Add(taskPart, true);
- WriteDBLog.Success("鍒涘缓琛ョ┖鎵樹换鍔�", $"浠诲姟缂栧彿锛歿taskPart.agv_tasknum}", "PCS");
+ agv_task.agv_taskstate = AGVTaskStateEnum.Create.ToString();
+ //agv_task.EndQuantity = EmptyStation.quantity;
+ agv_task.agv_toaddress = station.stationCode;
+ agvtaskRepository.Update(agv_task, true);
+ station.location_state = LocationStateEnum.Busy.ToString();
+ stationinfoRepository.Update(station, true);
+ WriteDBLog.Success("鏇存柊琛ョ┖鎵樹换鍔�", $"浠诲姟缂栧彿锛歿agv_task.agv_tasknum}", "PCS");
+ }
+ else
+ {
+ dt_agvtask taskPart = new dt_agvtask()
+ {
+ agv_fromaddress = "",
+ agv_id = Guid.NewGuid(),
+ agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"),
+ agv_grade = station.stationCode.Contains("W0100100") ? 3 : 2,
+ agv_createtime = DateTime.Now,
+ agv_taskstate = "Queue",
+ agv_qty = 1,
+ agv_tasktype = "TaskType_EmptyPallet",
+ agv_toaddress = station.stationCode,
+ agv_userid = "绯荤粺",
+ agv_TrayStatus = "EmptyTray",// station.tray_status,
+ agv_Traytype = station.tray_type
+ };
+ station.location_state = LocationStateEnum.Busy.ToString();
+ stationinfoRepository.Update(station, true);
+ agvtaskRepository.Add(taskPart, true);
+ WriteDBLog.Success("鍒涘缓琛ョ┖鎵樹换鍔�", $"浠诲姟缂栧彿锛歿taskPart.agv_tasknum}", "PCS");
+ }
+
}
}
}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/ReplaceTray.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/ReplaceTray.cs"
index da98f63..393c991 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/ReplaceTray.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/ReplaceTray.cs"
@@ -7,6 +7,7 @@
using WIDESEA_Comm;
using WIDESEA_Comm.LogInfo;
using WIDESEA_Comm.TaskNo;
+using WIDESEA_Common;
using WIDESEA_Core.EFDbContext;
using WIDESEA_Entity.DomainModels;
using WIDESEA_WCS.IRepositories;
@@ -61,47 +62,65 @@
foreach (var station in stations)
{
if (agvtaskRepository.Find(x => x.agv_fromaddress == station.stationCode || x.agv_toaddress == station.stationCode).Any()) continue;
+ #region MyRegion
var types = station.tray_type.Split('/');
- var area = types[0] == "SmallTray" ? "11" : "10";
- //鎵�1搴撳尯鐨勭┖鎵樹綅
- var EmptyStation = GetStation.EmptyPalletStation(area);
- //var EmptyStation = stationinfoRepository.Find(x => x.area == area && x.quantity < 5 && x.stationCode.Contains("A") /*&& x.location_state == "Empty"*/ && x.enable)
- // .OrderBy(x => x.column).OrderBy(x => x.line).FirstOrDefault();
- //if (EmptyStation == null)
- // EmptyStation = stationinfoRepository.Find(x => x.area == area && x.quantity < 5 && x.stationCode.Contains(area == "10" ? "D" : "C") /*&& x.location_state == "Empty"*/ && x.enable)
- // .OrderBy(x => x.line).OrderBy(x => x.column).FirstOrDefault();
- if (EmptyStation != null)
+ dt_agvtask agvtask = new dt_agvtask()
{
- dt_agvtask agvtask = new dt_agvtask()
- {
- agv_fromaddress = station.stationCode,
- agv_id = Guid.NewGuid(),
- agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"),
- agv_grade = 2,
- agv_createtime = DateTime.Now,
- agv_taskstate = "Create",
- //agv_materielid = station.stationType,
- agv_qty = 1,
- StarQuantity = 0,
- EndQuantity = EmptyStation.quantity,
- agv_tasktype = "TaskType_EmptyPallet",
- agv_toaddress = EmptyStation.stationCode,
- agv_userid = "绯荤粺",
- agv_TrayStatus = station.tray_status,
- //bindSN = station.bindSN,
- //agv_worktype = Convert.ToInt32(mesinfo.processCode),
- //agv_materbarcode = mesinfo.materialCode,
- agv_Traytype = types[0]
- };
- agvtaskRepository.Add(agvtask, true);
- station.location_state = LocationStateEnum.Busy.ToString();
- stationinfoRepository.Update(EmptyStation, true);
- EmptyStation.location_state = LocationStateEnum.Busy.ToString();
- stationinfoRepository.Update(EmptyStation, true);
- WriteDBLog.Success("鍒涘缓鏇存崲绌虹洏浠诲姟", $"浠诲姟缂栧彿锛歿agvtask.agv_tasknum}", "PCS");
- CreatePartQueue(agvtaskRepository, agvtask, agvtask.agv_Traytype == "SmallTray" ? "LargeTray" : "SmallTray");
- //CreatePartQueue(agvtaskRepository, agvtask, types[1]);
- }
+ agv_fromaddress = station.stationCode,
+ agv_id = Guid.NewGuid(),
+ agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"),
+ agv_grade = 1,
+ agv_createtime = DateTime.Now,
+ agv_taskstate = AGVTaskStateEnum.Queue.ToString(),
+ agv_qty = 1,
+ StarQuantity = 0,
+ EndQuantity = 0,//EmptyStation.quantity,
+ agv_tasktype = AGVTaskTypeEnum.TaskType_EmptyPallet.ToString(),
+ agv_toaddress = "",//EmptyStation.stationCode,
+ agv_userid = "绯荤粺",
+ agv_TrayStatus = station.tray_status,
+ agv_Traytype = types[0]
+ };
+ agvtaskRepository.Add(agvtask, true);
+ station.location_state = LocationStateEnum.Busy.ToString();
+ stationinfoRepository.Update(station, true);
+ WriteDBLog.Success("鍒涘缓鏇存崲绌虹洏浠诲姟", $"浠诲姟缂栧彿锛歿agvtask.agv_tasknum}", "PCS");
+ CreatePartQueue(agvtaskRepository, agvtask, agvtask.agv_Traytype == "SmallTray" ? "LargeTray" : "SmallTray");
+ #endregion
+
+ #region MyRegion
+ //var types = station.tray_type.Split('/');
+ //var area = types[0] == "SmallTray" ? "11" : "10";
+ ////鎵�1搴撳尯鐨勭┖鎵樹綅
+ //var EmptyStation = GetStation.EmptyPalletStation(area);
+ //if (EmptyStation != null)
+ //{
+ // dt_agvtask agvtask = new dt_agvtask()
+ // {
+ // agv_fromaddress = station.stationCode,
+ // agv_id = Guid.NewGuid(),
+ // agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"),
+ // agv_grade = 2,
+ // agv_createtime = DateTime.Now,
+ // agv_taskstate = "Create",
+ // agv_qty = 1,
+ // StarQuantity = 0,
+ // EndQuantity = EmptyStation.quantity,
+ // agv_tasktype = "TaskType_EmptyPallet",
+ // agv_toaddress = EmptyStation.stationCode,
+ // agv_userid = "绯荤粺",
+ // agv_TrayStatus = station.tray_status,
+ // agv_Traytype = types[0]
+ // };
+ // agvtaskRepository.Add(agvtask, true);
+ // station.location_state = LocationStateEnum.Busy.ToString();
+ // stationinfoRepository.Update(station, true);
+ // EmptyStation.location_state = LocationStateEnum.Busy.ToString();
+ // stationinfoRepository.Update(EmptyStation, true);
+ // WriteDBLog.Success("鍒涘缓鏇存崲绌虹洏浠诲姟", $"浠诲姟缂栧彿锛歿agvtask.agv_tasknum}", "PCS");
+ // CreatePartQueue(agvtaskRepository, agvtask, agvtask.agv_Traytype == "SmallTray" ? "LargeTray" : "SmallTray");
+ //}
+ #endregion
}
}
catch (Exception ex)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/RestockHCJ.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/RestockHCJ.cs"
index 5d521e3..12e45aa 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/RestockHCJ.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/RestockHCJ.cs"
@@ -205,14 +205,15 @@
{
if (agvtask.agv_tasktype == AGVTaskTypeEnum.TaskType_Outbound.ToString())
if (GetStation.QueueStation(agvtask.agv_fromaddress)) return;//闄愬埗涓�琛屼竴娆″彧鑳藉嚭涓�涓换鍔�
- var EmptyStations = stationinfoRepository.Find(x => x.stationCode.Contains("S01001") && (x.tray_status == TrayStateEnum.EmptyTray.ToString() || x.location_state == LocationStateEnum.Empty.ToString()) && x.enable).ToList();
+ //var EmptyStations = stationinfoRepository.Find(x => x.stationCode.Contains("S01001") && (x.tray_status == TrayStateEnum.EmptyTray.ToString() || x.location_state == LocationStateEnum.Empty.ToString()) && x.enable).ToList();
+ var EmptyStations = stationinfoRepository.Find(x => x.stationCode.Contains("S01001") && x.enable).ToList();
foreach (var EmptyStation in EmptyStations)
{
if (agvtaskService.Find(x => x.agv_toaddress == EmptyStation.stationCode).Any()) continue;
agvtask.agv_taskstate = AGVTaskStateEnum.Create.ToString();
agvtask.agv_toaddress = EmptyStation.stationCode;
- EmptyStation.location_state = LocationStateEnum.Busy.ToString();
- stationinfoRepository.Update(EmptyStation, true);
+ //EmptyStation.location_state = LocationStateEnum.Busy.ToString();
+ //stationinfoRepository.Update(EmptyStation, true);
agvtaskService.Update(agvtask, true);
WriteDBLog.Success("鏇存柊鍑哄簱闃熷垪浠诲姟", $"浠诲姟缂栧彿锛歿agvtask.agv_tasknum}", "PCS");
return;
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Comm/StateEnum/TrayEnum.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Comm/StateEnum/TrayEnum.cs"
new file mode 100644
index 0000000..bc79452
--- /dev/null
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Comm/StateEnum/TrayEnum.cs"
@@ -0,0 +1,38 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WIDESEA_Comm
+{
+ /// <summary>
+ /// 鎵樼洏鐘舵��
+ /// </summary>
+ public enum TrayStateEnum
+ {
+ /// <summary>
+ /// 绌烘墭鐩�
+ /// </summary>
+ EmptyTray,
+ /// <summary>
+ /// 婊℃墭鐩�
+ /// </summary>
+ StrogeTray
+
+ }
+ /// <summary>
+ /// 鎵樼洏绫诲瀷
+ /// </summary>
+ public enum TrayTypeEnum
+ {
+ /// <summary>
+ /// 灏忔墭鐩�
+ /// </summary>
+ SmallTray,
+ /// <summary>
+ /// 澶ф墭鐩�
+ /// </summary>
+ LargeTray,
+ }
+}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/EmptyPalletTask.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/EmptyPalletTask.cs"
new file mode 100644
index 0000000..1f184fa
--- /dev/null
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/EmptyPalletTask.cs"
@@ -0,0 +1,95 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WIDESEA_Comm;
+using WIDESEA_Comm.LogInfo;
+using WIDESEA_Common;
+using WIDESEA_Core.EFDbContext;
+using WIDESEA_Entity.DomainModels;
+using WIDESEA_WCS.JobsPart.Common;
+using WIDESEA_WMS.IRepositories;
+using WIDESEA_WMS.Repositories;
+using static System.Collections.Specialized.BitVector32;
+
+namespace WIDESEA_WMS.Common
+{
+ public partial class AGVServer
+ {
+ /// <summary>
+ /// 鏇存柊鍙栫┖鎵橀槦鍒椾换鍔�
+ /// </summary>
+ public static void UpdateEmptyPalletTask()
+ {
+ string tasknum = "";
+ try
+ {
+ VOLContext Context = new VOLContext();
+ Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(Context);
+ Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(Context);
+
+ #region 鍙犵洏鍖烘弧5涓叆搴�
+ var EmptyStations = stationinfoRepository.Find(x => x.stationCode.Contains("DD") && x.enable).ToList();
+ var EmptyD = EmptyStations.Where(x => x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity == 5).FirstOrDefault();
+ if (EmptyD != null) EmptyTray.CreateEmptyTrayIn(stationinfoRepository, EmptyD);
+ #endregion
+ var agv_task = agvtaskRepository.Find(x => x.agv_taskstate == AGVTaskStateEnum.Queue.ToString() && x.agv_tasktype == AGVTaskTypeEnum.TaskType_EmptyPallet.ToString() && string.IsNullOrEmpty(x.agv_toaddress)).OrderByDescending(x => x.agv_grade).ThenBy(x => x.agv_createtime).FirstOrDefault();
+ if (agv_task != null)
+ {
+ tasknum = agv_task.agv_tasknum;
+ #region MyRegion
+ //var task = agvtaskRepository.Find(x => (x.agv_toaddress.Contains("W") || x.agv_toaddress.Contains("X")) && x.agv_taskstate == AGVTaskStateEnum.Queue.ToString() && x.agv_tasktype == AGVTaskTypeEnum.TaskType_EmptyPallet.ToString() && x.agv_Traytype == agv_task.agv_Traytype).OrderByDescending(x => x.agv_grade).ThenBy(x => x.agv_createtime).FirstOrDefault();
+ //if (task != null)
+ //{
+ // task.agv_fromaddress = station.stationCode;
+ // task.StarQuantity = 0;
+ // task.agv_taskstate = "Create";
+ // if (station.stationCode.Contains("S0100100"))
+ // task.agv_grade = 3;
+ // agvtaskService.Update(task, true);
+ // station.location_state = LocationStateEnum.Busy.ToString();
+ // stationinfoRepository.Update(station, true);
+ // WriteDBLog.Success("鏇存柊琛ョ┖鎵橀槦鍒椾换鍔�", $"浠诲姟缂栧彿锛歿task.agv_tasknum}锛屾墭鐩樹俊鍙�:{PalletSignal},璐х墿淇″彿:{MaterialSignal}", "WMS");
+ // return;
+ //}
+ #endregion
+ dt_stationinfo EmptyStation = null;
+ #region 妫�娴嬩笂鏂欑殑绌烘墭鍙犵洏
+ if (agv_task.agv_fromaddress.Contains("S"))
+ {
+ //var EmptyStations = stationinfoRepository.Find(x => x.stationCode.Contains("DD") && x.quantity < 5 && x.enable).ToList();
+ EmptyStation = EmptyStations.Where(x => x.tray_type == agv_task.agv_Traytype && x.quantity < 5 && x.location_state == LocationStateEnum.Stroge.ToString()).FirstOrDefault();
+ if (EmptyStation == null)
+ EmptyStation = EmptyStations.Where(x => x.location_state == LocationStateEnum.Empty.ToString() && x.quantity == 0).FirstOrDefault();
+ if (EmptyStation == null)
+ {
+ EmptyD = EmptyStations.Where(x => x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).OrderByDescending(x => x.quantity).FirstOrDefault();
+ if (EmptyD != null) EmptyTray.CreateEmptyTrayIn(stationinfoRepository, EmptyD);
+ }
+ }
+ #endregion
+ else
+ {
+ EmptyStation = GetStation.EmptyPalletStation(agv_task.agv_Traytype == "SmallTray" ? "11" : "10");
+ }
+
+ if (EmptyStation != null)
+ {
+ agv_task.agv_taskstate = AGVTaskStateEnum.Create.ToString();
+ agv_task.EndQuantity = EmptyStation.quantity;
+ agv_task.agv_toaddress = EmptyStation.stationCode;
+ agvtaskRepository.Update(agv_task, true);
+ EmptyStation.location_state = LocationStateEnum.Busy.ToString();
+ stationinfoRepository.Update(EmptyStation, true);
+ WriteDBLog.Success("鏇存柊鑷姩鍙栫┖鎵橀槦鍒椾换鍔�", $"浠诲姟缂栧彿锛歿agv_task.agv_tasknum}", "WMS");
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ WriteLog.Write_Log("鎶ラ敊鏃ュ織", "鏇存柊鑷姩鍙栫┖鎵橀槦鍒椾换鍔�", "閿欒淇℃伅锛�", $"{tasknum}锛涢敊璇俊鎭細{ex.Message}");
+ }
+ }
+ }
+}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/GetStation/EmptyPalletStation.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/GetStation/EmptyPalletStation.cs"
new file mode 100644
index 0000000..4d45e09
--- /dev/null
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/GetStation/EmptyPalletStation.cs"
@@ -0,0 +1,204 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WIDESEA_Comm;
+using WIDESEA_Comm.LogInfo;
+using WIDESEA_Core.EFDbContext;
+using WIDESEA_Entity.DomainModels;
+using WIDESEA_WMS.IRepositories;
+using WIDESEA_WMS.Repositories;
+using static System.Collections.Specialized.BitVector32;
+
+namespace WIDESEA_WCS.JobsPart.Common
+{
+ public class GetStation
+ {
+ /// <summary>
+ /// 褰撳墠搴撲綅鍚屼竴琛屾槸鍚﹀瓨鍦ㄥ叆搴撳崰鐢�
+ /// true锛氭槸 false锛氬惁
+ /// </summary>
+ /// <param name="StationCode"></param>
+ /// <returns></returns>
+ public static bool InBusyStation(string StationCode)
+ {
+ bool OK = false;
+ try
+ {
+ VOLContext Context = new VOLContext();
+ Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(Context);
+ var station = stationinfoRepository.Find(x => x.stationCode == StationCode).FirstOrDefault();
+ OK = stationinfoRepository.Find(x => x.area == station.area && x.line == station.line && x.location_state == LocationStateEnum.InBusy.ToString()).Any();
+ }
+ catch (Exception ex)
+ {
+
+ }
+ return OK;
+ }
+ /// <summary>
+ /// 褰撳墠搴撲綅鍚屼竴琛屾槸鍚﹀瓨鍦ㄥ嚭搴撳崰鐢�
+ /// true锛氭槸 false锛氬惁
+ /// </summary>
+ /// <param name="StationCode"></param>
+ /// <returns></returns>
+ public static bool OutBusyStation(string StationCode)
+ {
+ bool OK = false;
+ try
+ {
+ VOLContext Context = new VOLContext();
+ Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(Context);
+ var station = stationinfoRepository.Find(x => x.stationCode == StationCode).FirstOrDefault();
+ OK = stationinfoRepository.Find(x => x.area == station.area && x.line == station.line && x.location_state == LocationStateEnum.OutBusy.ToString()).Any();
+ }
+ catch (Exception ex)
+ {
+
+ }
+ return OK;
+ }
+ /// <summary>
+ /// 褰撳墠搴撲綅澶栬竟鐨勮揣浣嶆槸鍚﹂兘涓虹┖
+ /// true锛氬惁 false锛氭槸
+ /// </summary>
+ /// <param name="StationCode"></param>
+ /// <returns></returns>
+ public static bool QueueStation(string StationCode)
+ {
+ bool OK = false;
+ try
+ {
+ VOLContext Context = new VOLContext();
+ Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(Context);
+ var station = stationinfoRepository.Find(x => x.stationCode == StationCode).FirstOrDefault();
+ OK = stationinfoRepository.Find(x => x.area == station.area && x.line == station.line && x.column > station.column && x.location_state != LocationStateEnum.Empty.ToString()).Any();
+ }
+ catch (Exception ex)
+ {
+
+ }
+ return OK;
+ }
+ /// <summary>
+ /// 鎵惧彲鍏ュ簱绌烘墭浣�
+ /// </summary>
+ public static void EmptyStation()
+ {
+ try
+ {
+ VOLContext Context = new VOLContext();
+ Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(Context);
+ Idt_agvtaskRepository agvtaskService = new dt_agvtaskRepository(Context);
+ var Stations = stationinfoRepository.Find(x => x.stationCode.Contains("DD") && x.quantity == 5 && x.enable).ToList();
+ foreach (var Station in Stations)
+ {
+ var area = Station.tray_type == "SmallTray" ? "11" : "10";
+ }
+ }
+ catch (Exception ex)
+ {
+
+ }
+ }
+
+ public static dt_stationinfo Station(dt_stationinfo EmptyStation, Idt_stationinfoRepository stationinfoRepository)
+ {
+ dt_stationinfo stationinfo = null;
+ try
+ {
+ if (stationinfoRepository.Find(x => x.area == EmptyStation.area && x.line == EmptyStation.line && x.location_state.Contains("Busy")).Any()) return stationinfo;
+
+
+ stationinfo = stationinfoRepository.Find(x => x.area == EmptyStation.area && x.line == EmptyStation.line && x.quantity > 0 && x.enable).OrderByDescending(x => x.column).FirstOrDefault();
+ if (stationinfo != null)
+ {
+ if (stationinfo.quantity < 5) return stationinfo;
+ else
+ stationinfo = stationinfoRepository.Find(x => x.area == EmptyStation.area && x.line == EmptyStation.line && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).OrderBy(x => x.column).FirstOrDefault();
+ }
+ else
+ {
+ stationinfo = stationinfoRepository.Find(x => x.area == EmptyStation.area && x.line == EmptyStation.line && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).OrderBy(x => x.column).FirstOrDefault();
+ }
+ //if (stationinfo == null)
+
+ }
+ catch (Exception ex)
+ {
+
+ }
+ return stationinfo;
+ }
+ /// <summary>
+ /// 绌烘墭鍙叆搴撹揣浣�
+ /// </summary>
+ /// <param name="area"></param>
+ /// <returns></returns>
+ public static dt_stationinfo EmptyPalletStation(string area)
+ {
+ dt_stationinfo stationinfo = null;
+ try
+ {
+ VOLContext Context = new VOLContext();
+ Idt_agvtaskRepository agvtaskService = new dt_agvtaskRepository(Context);
+ Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(Context);
+
+ #region 鏌ユ壘绌烘墭鐩樺簱鍖�
+ //if (stationinfoRepository.Find(x => x.area == area && x.location_state == LocationStateEnum.Busy.ToString()).Any() && area != "10")
+ if (stationinfoRepository.Find(x => x.stationCode == "A01001001" && x.quantity == 5 && x.location_state == LocationStateEnum.Stroge.ToString()).Any())
+ {
+ var EmptyStation = stationinfoRepository.Find(x => x.stationCode == "C01005002" && x.location_state == LocationStateEnum.Empty.ToString()).FirstOrDefault();
+ if (EmptyStation != null)
+ {
+ if (!stationinfoRepository.Find(x => x.line == EmptyStation.line && x.area == EmptyStation.area && x.location_state != LocationStateEnum.Empty.ToString()).Any())
+ return EmptyStation;
+ }
+ EmptyStation = stationinfoRepository.Find(x => x.quantity > 0 && x.stationCode == "C01005002" && x.location_state == "Stroge" && x.tray_status == "EmptyTray" && x.enable).FirstOrDefault();
+
+
+ if (EmptyStation != null) stationinfo = Station(EmptyStation, stationinfoRepository);
+ if (stationinfo != null) return stationinfo;
+
+ EmptyStation = stationinfoRepository.Find(x => x.area == EmptyStation.area && x.line == EmptyStation.line && x.enable).OrderByDescending(x => x.column).FirstOrDefault();
+
+ if (EmptyStation.quantity == 5)
+ {
+ EmptyStation = stationinfoRepository.Find(x => x.stationCode == "C01004002" && x.location_state == LocationStateEnum.Empty.ToString()).FirstOrDefault();
+ if (EmptyStation != null)
+ {
+ if (!stationinfoRepository.Find(x => x.line == EmptyStation.line && x.area == EmptyStation.area && x.location_state != LocationStateEnum.Empty.ToString()).Any())
+ return EmptyStation;
+ }
+
+ EmptyStation = stationinfoRepository.Find(x => x.quantity > 0 && x.stationCode == "C01004002" && x.location_state == "Stroge" && x.tray_status == "EmptyTray" && x.enable).FirstOrDefault();
+ if (EmptyStation != null) stationinfo = Station(EmptyStation, stationinfoRepository);
+ }
+
+ }
+ else
+ {
+ if (stationinfoRepository.Find(x => x.area == area && x.location_state == LocationStateEnum.Busy.ToString()).Any()) return stationinfo;
+ stationinfo = stationinfoRepository.Find(x => x.area == area && x.quantity > 0 && x.enable).OrderBy(x => x.column).FirstOrDefault();
+ if (stationinfo != null)
+ if (stationinfo.quantity < 5) return stationinfo;
+ stationinfo = stationinfoRepository.Find(x => x.area == area && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).OrderByDescending(x => x.column).FirstOrDefault();
+
+ }
+ #endregion
+
+ #region 鍒ゆ柇褰撳墠璐т綅鏄惁瀛樺湪浠诲姟
+ if (stationinfo != null)
+ if (agvtaskService.Find(x => /*x.agv_fromaddress == stationinfo.stationCode ||*/ x.agv_toaddress == stationinfo.stationCode).Any()) stationinfo = null;
+ #endregion
+
+ }
+ catch (Exception ex)
+ {
+ throw;
+ }
+ return stationinfo;
+ }
+ }
+}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/GetStation/EmptyTrayIn.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/GetStation/EmptyTrayIn.cs"
new file mode 100644
index 0000000..f8a976b
--- /dev/null
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/GetStation/EmptyTrayIn.cs"
@@ -0,0 +1,90 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WIDESEA_Comm.LogInfo;
+using WIDESEA_Comm.TaskNo;
+using WIDESEA_Comm;
+using WIDESEA_Core.EFDbContext;
+using WIDESEA_Entity.DomainModels;
+using WIDESEA_WMS.IRepositories;
+using WIDESEA_WMS.Repositories;
+
+namespace WIDESEA_WCS.JobsPart.Common
+{
+ public class EmptyTray
+ {
+ /// <summary>
+ /// 绌烘墭鍙犵洏鍏ュ簱
+ /// </summary>
+ public static void EmptyTrayIn()
+ {
+ try
+ {
+ VOLContext Context = new VOLContext();
+ Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(Context);
+ var EmptyStations = stationinfoRepository.Find(x => x.stationCode.Contains("DD") && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity == 5 && x.enable).ToList();
+ foreach (var EmptyStation in EmptyStations)
+ {
+ CreateEmptyTrayIn(stationinfoRepository, EmptyStation);
+ }
+ }
+ catch (Exception ex)
+ {
+ WriteDBLog.Success("鍒涘缓鍙犵洏浣嶇┖鎵樺叆搴撲换鍔�", $"閿欒淇℃伅锛歿ex.Message}", "PCS");
+ }
+ }
+ /// <summary>
+ /// 鍒涘缓绌烘墭鍙犵洏鍏ュ簱浠诲姟
+ /// </summary>
+ /// <param name="stationinfoRepository"></param>
+ /// <param name="EmptyStation"></param>
+ public static void CreateEmptyTrayIn(Idt_stationinfoRepository stationinfoRepository, dt_stationinfo EmptyStation)
+ {
+ VOLContext Context = new VOLContext();
+ Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(Context);
+ try
+ {
+ if (agvtaskRepository.Find(x => x.agv_fromaddress == EmptyStation.stationCode || x.agv_toaddress == EmptyStation.stationCode).Any()) return;
+ var area = EmptyStation.tray_type == "SmallTray" ? "11" : "10";
+ var toEmptyStation = GetStation.EmptyPalletStation(area);
+ if (toEmptyStation != null)
+ {
+ #region 鍚屼竴涓┖鎵樹綅鍙兘鍚屾椂鐢熸垚涓�涓┖鎵樹换鍔�
+ if (agvtaskRepository.Find(x => x.agv_fromaddress == toEmptyStation.stationCode || x.agv_toaddress == toEmptyStation.stationCode).Any()) return;
+ #endregion
+
+ dt_agvtask agvtask = new dt_agvtask()
+ {
+ agv_fromaddress = EmptyStation.stationCode,
+ agv_id = Guid.NewGuid(),
+ agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"),
+ agv_grade = 3,
+ agv_createtime = DateTime.Now,
+ agv_taskstate = "Create",
+ //agv_materielid = station.stationType,
+ agv_qty = EmptyStation.quantity - toEmptyStation.quantity,
+ StarQuantity = toEmptyStation.quantity,
+ EndQuantity = toEmptyStation.quantity,
+ agv_tasktype = "TaskType_EmptyPallet",
+ agv_toaddress = toEmptyStation.stationCode,
+ agv_userid = "绯荤粺",
+ agv_TrayStatus = "EmptyTray",//station.tray_status,
+ agv_Traytype = EmptyStation.tray_type,
+ };
+ agvtaskRepository.Add(agvtask, true);
+ EmptyStation.location_state = LocationStateEnum.Busy.ToString();
+ stationinfoRepository.Update(EmptyStation, true);
+ toEmptyStation.location_state = LocationStateEnum.Busy.ToString();
+ stationinfoRepository.Update(toEmptyStation, true);
+ WriteDBLog.Success("鍒涘缓鍙犵洏浣嶇┖鎵樺叆搴撲换鍔�", $"浠诲姟缂栧彿锛歿agvtask.agv_tasknum}", "PCS");
+ }
+ }
+ catch (Exception ex)
+ {
+ WriteDBLog.Error("鍒涘缓鍙犵洏浣嶇┖鎵樺叆搴撲换鍔�", $"閿欒淇℃伅锛歿ex.Message}", "PCS");
+ }
+ }
+ }
+}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Services/Taskinfo/Partial/dt_agvtaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Services/Taskinfo/Partial/dt_agvtaskService.cs"
index fc7bb72..799c98a 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Services/Taskinfo/Partial/dt_agvtaskService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Services/Taskinfo/Partial/dt_agvtaskService.cs"
@@ -27,6 +27,9 @@
using StackExchange.Redis;
using WIDESEA_Comm;
using WIDESEA_Entity.DomainModels.Mes;
+using WIDESEA_WMS.Common;
+using System.Reflection.Emit;
+using System.Threading.Tasks;
namespace WIDESEA_WMS.Services
{
@@ -47,7 +50,62 @@
//澶氱鎴蜂細鐢ㄥ埌杩檌nit浠g爜锛屽叾浠栨儏鍐靛彲浠ヤ笉鐢�
//base.Init(dbRepository);
}
-
+ public override WebResponseContent Del(object[] keys, bool delList = true)
+ {
+ #region 鎵归噺淇敼璐т綅鐘舵��
+ //VOLContext context = new VOLContext();
+ //Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(context);
+ //var fromaddress = repository.Find(x => keys.Contains(x.agv_id)).Select(x => x.agv_fromaddress).ToList();
+ //var stations = stationinfoRepository.Find(x => fromaddress.Contains(x.stationCode)).ToList();
+ //foreach (var station in stations)
+ //{
+ // station.location_state = LocationStateEnum.Stroge.ToString();
+ // //station.tray_type= TrayTypeEnum.SmallTray.ToString();
+ // //station.tray_status= TrayStateEnum.StrogeTray.ToString();
+ //}
+ //stationinfoRepository.UpdateRange(stations, x => new { x.location_state }, true);
+ #endregion
+ VOLContext volContext = new VOLContext();
+ Idt_agvtask_htyRepository agvtask_HtyRepository=new dt_agvtask_htyRepository(volContext);
+ var agvtasks = repository.Find(x => keys.Contains(x.agv_id)).ToList();
+ List<dt_agvtask_hty> dt_Agvtask_Hties = new List<dt_agvtask_hty>();
+ foreach (var task in agvtasks)
+ {
+ dt_agvtask_hty agvtask_Hty = new dt_agvtask_hty()
+ {
+ hty_pkid = Guid.NewGuid(),
+ agv_id = task.agv_id,
+ agv_tasknum = task.agv_tasknum,
+ agv_materielid = task.agv_materielid,
+ agv_qty = task.agv_qty,
+ agv_createtime = task.agv_createtime,
+ agv_realesstime = task.agv_realesstime,
+ agv_executingBeginTime = task.agv_executingBeginTime,
+ agv_executingEndTime = task.agv_executingEndTime,
+ agv_completeBeginTime = task.agv_completeBeginTime,
+ agv_finishedtime = task.agv_finishedtime,
+ agv_taskstate = task.agv_taskstate,
+ agv_tasktype = task.agv_tasktype,
+ agv_fromaddress = task.agv_fromaddress,
+ agv_toaddress = task.agv_toaddress,
+ agv_operatetype = "Del",
+ agv_compeletor = UserContext.Current.UserName,
+ agv_completedate = DateTime.Now,
+ agv_grade = task.agv_grade,
+ agv_userid = task.agv_userid,
+ agv_Traytype = task.agv_Traytype,
+ agv_TrayStatus = task.agv_TrayStatus,
+ agv_worktype = task.agv_worktype,
+ agv_remark = task.agv_remark,
+ bindSN = task.bindSN,
+ jobID = task.jobID,
+ agv_materbarcode = task.agv_materbarcode,
+ };
+ dt_Agvtask_Hties.Add(agvtask_Hty);
+ }
+ agvtask_HtyRepository.AddRange(dt_Agvtask_Hties,true);
+ return base.Del(keys, delList);
+ }
public WebResponseContent addNgTask(MesRequestTemp requestTemp)
{
WebResponseContent content = new WebResponseContent();
@@ -102,6 +160,7 @@
var agv_id = saveModel.MainData["agv_id"].ToString();
var task = _repository.Find(x => x.agv_id.ToString() == agv_id).FirstOrDefault();
if (task.agv_taskstate != AGVTaskStateEnum.Queue.ToString()) return content.Error("褰撳墠浠诲姟涓嶅彲鏇存敼锛�");
+ WriteDBLog.Success($"鎵嬪姩淇敼浠诲姟", new { 鏁版嵁 = saveModel }, "WMS", UserContext.Current.UserName);
return base.Update(saveModel);
}
#region 娣诲姞NG浠诲姟
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WebApi/Controllers/JobTask.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WebApi/Controllers/JobTask.cs"
index 371f541..9d6b117 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WebApi/Controllers/JobTask.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WebApi/Controllers/JobTask.cs"
@@ -12,6 +12,7 @@
[Invoke(Begin = "2024-01-01 00:00", Interval = 1000 * 5, /*IsEnabled = true,*/ SkipWhileExecuting = true)]
public void TaskTime()
{
+ AGVServer.UpdateEmptyPalletTask();
AGVServer.SendAgvTask();
}
}
--
Gitblit v1.9.3