From 76eef0389848065963a295c66163a630697054fa Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期日, 07 七月 2024 09:47:01 +0800
Subject: [PATCH] PDA
---
代码管理/PCS/WCS_Server/WIDESEA_WCS/Common/Pipeline.cs | 121 ++++++++++++---------------------------
1 files changed, 38 insertions(+), 83 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 bff502d..b200c66 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"
@@ -17,6 +17,7 @@
using WIDESEA_WCS.JobsPart.Common;
using System.Xml.Linq;
using WIDESEA_Common;
+using System.Net;
namespace WIDESEA_WCS
{
@@ -164,10 +165,10 @@
{
Station.location_state = LocationStateEnum.Abnormal.ToString();
Station.remark = "杞﹁疆鏁伴噺涓嶴N鍙锋暟閲忎笉涓�鑷�";
- stationinfoRepository.Update(Station, true);
+ stationinfoRepository.Update(Station, x => new { x.location_state, x.remark }, true);
Gantry_client.WriteByOrder("W_RequestUnload", false, number);//淇″彿涓篺alse妗佹灦鍋滄杩涘叆
#region 鏃ュ織璁板綍
- WriteDBLog.Error("涓婃枡鍖�", $"鍐欏叆妗佹灦淇℃伅锛歕nW_RequestUnload锛歠alse\n\n{Station.stationCode}杞﹁疆鏁伴噺涓嶴N鍙锋暟閲忎笉涓�鑷�", "PCS");
+ //WriteDBLog.Error("涓婃枡鍖�", $"鍐欏叆妗佹灦淇℃伅锛歕nW_RequestUnload锛歠alse\n\n{Station.stationCode}杞﹁疆鏁伴噺涓嶴N鍙锋暟閲忎笉涓�鑷�", "PCS");
#endregion
return;
}
@@ -178,7 +179,15 @@
if (PalletSignal == 1 && MaterialSignal == 1)
{
- Gantry_client.WriteByOrder("W_Wheel_Type", (Int16)Convert.ToInt16(QueryMateriel(Station.stationType) == null ? QueryMateriel1(Station.stationType).TypeId : QueryMateriel(Station.stationType).TypeId), number);//杞﹁疆绫诲瀷
+ var geometry = QueryMateriel(Station.stationType);
+ if (geometry == null)
+ {
+ Station.remark = "鏈壘鍒拌溅杞俊鎭�";
+ stationinfoRepository.Update(Station, x => new { x.remark }, true);
+ Gantry_client.WriteByOrder("W_RequestUnload", false, number);//淇″彿涓篺alse妗佹灦鍋滄杩涘叆
+ return;
+ }
+ Gantry_client.WriteByOrder("W_Wheel_Type", (Int16)Convert.ToInt16(geometry.TypeId), number);//杞﹁疆绫诲瀷
var area = Convert.ToInt16(Station.stationCode.Substring(Station.stationCode.Length - 1, 1));
Gantry_client.WriteByOrder("W_AreaNr", (Int16)area, number);//鍖哄煙璐т綅鍙�
Gantry_client.WriteByOrder("W_IndexNr", (Int16)SNS.Length, number);//鎵樼洏涓婄殑绗嚑涓溅杞�
@@ -187,7 +196,7 @@
Gantry_client.WriteByOrder("W_RequestUnload", true, number);
#region 鏃ュ織璁板綍
WriteDBLog.Success("涓婃枡鍖虹敵璇�", $"璇诲彇鎵樼洏鍏夌數淇″彿锛歿PalletSignal}\n璇诲彇绗竴涓溅杞厜鐢典俊鍙凤細{MaterialSignal}\n\n" +
- $"鍐欏叆妗佹灦淇℃伅锛歕n鍖哄煙璐т綅鍙凤細{area}\n鎵樼洏涓婄殑绗嚑涓溅杞細{SNS.Length}\n鎵樼洏绫诲瀷锛歿1}\n杞﹁疆绫诲瀷锛歿(QueryMateriel(Station.stationType) == null ? QueryMateriel1(Station.stationType).TypeId : QueryMateriel(Station.stationType).TypeId)}" +
+ $"鍐欏叆妗佹灦淇℃伅锛歕n鍖哄煙璐т綅鍙凤細{area}\n鎵樼洏涓婄殑绗嚑涓溅杞細{SNS.Length}\n鎵樼洏绫诲瀷锛歿1}\n杞﹁疆绫诲瀷锛歿geometry.TypeId}" +
$"\n杞﹁疆SN鍙凤細{SNS[SNS.Length - 1]}\nW_RequestUnload锛歵rue", "PCS");
#endregion
}
@@ -210,6 +219,11 @@
// }
//}
#endregion
+ }
+ else
+ {
+ var count = Gantry_client.ReadByOrder<Int16>("W_IndexNr", number);
+ if (Station.quantity != count) Gantry_client.WriteByOrder("W_RequestUnload", false, number);
}
}
else
@@ -399,39 +413,23 @@
var MaterialSignal = (Int16)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_MaterialSignal").First(), client);//璇诲彇璐х墿淇″彿:1:鏈�,2鏃�
if (PalletSignal == 1 && MaterialSignal == 2 && (station.stationCode.Contains("S0100100") ? station.tray_status == "EmptyTray" : true))
{
- var area = station.tray_type == "SmallTray" ? "11" : "10";
- remark = "鏌ヨ鏄惁瀛樺湪琛ョ┖鎵橀槦鍒椾换鍔�";
- var task = agvtaskService.Find(x => (x.agv_toaddress.Contains("W") || x.agv_toaddress.Contains("X")) && x.agv_taskstate == "Queue" && x.agv_tasktype == "TaskType_EmptyPallet" && x.agv_Traytype == station.tray_type).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}", "PCS");
- continue;
- }
- #region 妫�娴嬩笂鏂欑殑绌烘墭鍙犵洏
- //remark = "鏌ヨ绌烘墭鍙犵洏浣�";
- //var EmptyStations = stationinfoRepository.Find(x => x.stationCode.Contains("DD") && x.enable).ToList();
- //if (stationCode.Contains("S"))
+ #region 鏌ヨ鏄惁瀛樺湪琛ョ┖鎵橀槦鍒椾换鍔�
+ //var area = station.tray_type == "SmallTray" ? "11" : "10";
+ //remark = "鏌ヨ鏄惁瀛樺湪琛ョ┖鎵橀槦鍒椾换鍔�";
+ //var task = agvtaskService.Find(x => (x.agv_toaddress.Contains("W") || x.agv_toaddress.Contains("X")) && x.agv_taskstate == "Queue" && x.agv_tasktype == "TaskType_EmptyPallet" && x.agv_Traytype == station.tray_type).OrderByDescending(x => x.agv_grade).ThenBy(x => x.agv_createtime).FirstOrDefault();
+ //if (task != null)
//{
- // //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);
+ // 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}", "PCS");
+ // continue;
+ //}
#endregion
#region 鍒涘缓鍙栫┖鎵橀槦鍒椾换鍔�
@@ -443,61 +441,19 @@
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,
+ EndQuantity = 0,
agv_tasktype = AGVTaskTypeEnum.TaskType_EmptyPallet.ToString(),
- agv_toaddress = "",//EmptyStation.stationCode,
+ agv_toaddress = "",
agv_userid = "绯荤粺",
- agv_TrayStatus = "EmptyTray",//station.tray_status,
+ agv_TrayStatus = "EmptyTray",
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)
- //{
- // 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
}
}
@@ -509,7 +465,6 @@
}
catch (Exception ex)
{
- //WriteDBLog.Error("鍒涘缓鑷姩鍙栫┖鎵樹换鍔�", $"閿欒淇℃伅锛歿ex.Message}", "PCS");
WriteLog.Write_Log("鎶ラ敊鏃ュ織", "鍒涘缓鑷姩鍙栫┖鎵橀槦鍒椾换鍔�", "閿欒淇℃伅锛�", $"閿欒淇℃伅锛歿ex.Message}");
}
}
@@ -623,7 +578,7 @@
Idt_mes_headRepository mes_HeadRepository = new dt_mes_headRepository(Context);
IVV_Mes_WorkinfoRepository workinfoRepository = new VV_Mes_WorkinfoRepository(Context);
//var mes_Detail = freeDB.Select<dt_mes_detail>().Where(x => x.SN == SN).First();
- var Mes_Work = workinfoRepository.Find(x => x.SN == SN && x.processCode == "28").FirstOrDefault();
+ var Mes_Work = workinfoRepository.Find(x => x.SN == SN && x.processCode == "28").OrderByDescending(x => x.CreateTime).FirstOrDefault();
var mes_Detail = mes_DetailRepository.Find(x => x.SN == SN && x.jobID == Mes_Work.jobID).FirstOrDefault();
if (mes_Detail != null)
{
--
Gitblit v1.9.3