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/Gantry.cs | 35 +++++++++++++----------------------
1 files changed, 13 insertions(+), 22 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs"
index d372017..d56fee2 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs"
@@ -27,7 +27,7 @@
namespace WIDESEA_WCS
{
- public class Gantry
+ public class Gantry : Gantry2
{
#region 鏌ヨ杞﹁疆鏁版嵁
/// <summary>
@@ -75,7 +75,7 @@
}
}
- var Mes_Work = workinfoRepository.Find(x => x.SN == wp_id && x.processCode == (name != "杈婇亾涓婃枡鏌ヨ杞﹁疆" ? "17" : "28")).FirstOrDefault();
+ var Mes_Work = workinfoRepository.Find(x => x.SN == wp_id && x.processCode == (name != "杈婇亾涓婃枡鏌ヨ杞﹁疆" ? "17" : "28")).OrderByDescending(x => x.CreateTime).FirstOrDefault();
if (Mes_Work == null)
{
client.WriteByOrder("W_i_status", (byte)2, name);
@@ -173,7 +173,7 @@
}
var wp_type = DBExtension.Read(details.Where(x => x.plcdetail_name == "R_o_wp_type").First(), client);
- var Mes_Work = workinfoRepository.Find(x => x.SN == wp_id && x.processCode == (name != "杈婇亾涓婃枡鏌ヨ璁㈠崟" ? "17" : "28")).FirstOrDefault();
+ var Mes_Work = workinfoRepository.Find(x => x.SN == wp_id && x.processCode == (name != "杈婇亾涓婃枡鏌ヨ璁㈠崟" ? "17" : "28")).OrderByDescending(x => x.CreateTime).FirstOrDefault();
if (Mes_Work == null)
{
client.WriteByOrder("W_i_status", (byte)2, name);
@@ -186,17 +186,6 @@
var mes_Head = mes_HeadRepository.FindFirst(x => x.jobID == Mes_Work.jobID);
- //闇�娣诲姞鏌ヨ杞﹁疆SN鍙疯鍗曢�昏緫 闇�娣诲姞鍏ュ簱妯″紡鍒ゆ柇锛屾墜鍔ㄥ叆搴撴ā寮忛渶浜哄伐娣诲姞鍏ュ簱搴撳尯锛屽惁鍒欐姤璀�
- var pattern = patternRepository.FindFirst(x => x.pattern_name == "鍏ュ簱妯″紡").pattern_state;
- if (pattern != 1 && string.IsNullOrEmpty(mes_Head.area))
- {
- client.WriteByOrder("W_i_status", (byte)4, name);
- client.WriteByOrder("R_oi_on", (byte)0, name);
- #region 鏃ュ織璁板綍
- WriteLog.Write_Log(name, wp_id, "閿欒淇℃伅锛�", $"璇诲彇妗佹灦淇℃伅锛歕n杞﹁疆SN锛歿wp_id}\n\n鍐欏叆妗佹灦淇℃伅锛歕nW_i_status锛�4\nR_oi_on锛�0\n\n鎵嬪姩鍏ュ簱妯″紡鏈�夋嫨搴撳尯");
- #endregion
- continue;
- }
var geometry = Pipeline.QueryMateriel(Mes_Work.drawingNo);
if (geometry == null)
{
@@ -310,7 +299,7 @@
}
//var Wheel_id = DBExtension.Read(details.Where(x => x.plcdetail_name == "R_Wheel_id").First(), client).ToString();
- var Mes_Work = workinfoRepository.Find(x => x.SN == Wheel_SN && x.processCode == "17").FirstOrDefault();
+ var Mes_Work = workinfoRepository.Find(x => x.SN == Wheel_SN && x.processCode == "17").OrderByDescending(x => x.CreateTime).FirstOrDefault();
if (Mes_Work == null)
{
#region 鏃ュ織璁板綍
@@ -406,13 +395,13 @@
var Detail = mes_DetailRepository.FindFirst(x => x.jobID == Mes_Work.jobID && x.SN == Mes_Work.SN);
Detail.Status = "涓嬬嚎";
Detail.FinishTime = DateTime.Now;
- count = mes_DetailRepository.Update(Detail, true);
+ count = mes_DetailRepository.Update(Detail, x => new { x.Status, x.FinishTime }, true);
if (count < 1)
throw new Exception($"宸ュ崟瀛愯〃淇℃伅鏇存柊澶辫触锛佽溅杞甋N鍙凤細{Detail.SN}");
var Head = mes_HeadRepository.FindFirst(x => x.jobID == Detail.jobID);
Head.finishNum = Head.finishNum + 1;
if (Head.finishNum == Head.quantity) Head.FinishTime = DateTime.Now;
- count = mes_HeadRepository.Update(Head, true);
+ count = mes_HeadRepository.Update(Head, x => new { x.finishNum, x.FinishTime }, true);
if (count < 1)
throw new Exception($"宸ュ崟澶磋〃淇℃伅鏇存柊澶辫触锛佸伐鍗曞彿锛歿Head.jobID}");
#endregion
@@ -440,7 +429,7 @@
WriteLog.Write_Log(name + "鐢宠鏀炬枡寮傚父", "杞﹁疆SN鍙蜂负绌�", "", $"璇诲彇妗佹灦淇℃伅锛歕n杞﹁疆SN鍙凤細{Wheel_id}涓虹┖");
continue;
}
- var Work = workinfoRepository.Find(x => x.SN == Wheel_id && x.processCode == "17").FirstOrDefault();
+ var Work = workinfoRepository.Find(x => x.SN == Wheel_id && x.processCode == "17").OrderByDescending(x => x.CreateTime).FirstOrDefault();
if (Work == null)
{
client.WriteByOrder("W_Enabl_Load", false, name);//淇″彿涓篺alse妗佹灦鍋滄杩涘叆
@@ -474,7 +463,8 @@
#endregion
#region 鎵樼洏绫诲瀷涓嶄竴鑷撮渶鏇存崲鎵樼洏
- foreach (var Stationinfo in Stations)
+ stations = Stations.Where(x => x.enable).ToList();
+ foreach (var Stationinfo in stations)
{
if (Stationinfo.tray_type != "LargeTray" && /*(wheel == null ? wheel1.e :)*/ wheel.e > 1100)
{
@@ -637,7 +627,8 @@
if (!Stations.Where(x => x.enable && x.stationCode != NGStation && x.location_state != LocationStateEnum.Stroge.ToString()).Any())
{
var station = Stations.Where(x => x.enable && x.stationCode != NGStation && x.location_state == LocationStateEnum.Stroge.ToString()).OrderBy(x => x.lastUpdateTime).FirstOrDefault();
- agvtask(stationinfoRepository, station, Work, name == "3鍗曞厓涓嬫枡鍖�" ? "TaskType_OutsourceInbound" : "TaskType_Inbound");
+ if (station != null)
+ agvtask(stationinfoRepository, station, Work, name == "3鍗曞厓涓嬫枡鍖�" ? "TaskType_OutsourceInbound" : "TaskType_Inbound");
}
#endregion
}
@@ -728,7 +719,7 @@
//WriteDBLog.Success(name + "鍏佽鏀炬枡", $"璇诲彇妗佹灦淇℃伅锛歕n杞﹁疆SN锛歿Wheel_id}\n杞瀷ID锛歿Wheel_Type}\n杞﹁疆鐘舵�侊細NG" +$"\n璇诲彇鎵樼洏鍏夌數淇″彿锛歿PalletSignal}" +
// $"\n\n鍐欏叆妗佹灦淇℃伅锛歕n涓嬫枡浣嶅彿锛歿area}\n绗嚑涓溅杞細{(Stationinfo.quantity + 1)}\n鎵樼洏绫诲瀷锛�1\nW_Enabl_Load锛歵rue", "PCS");
WriteLog.Write_Log(name + "鐢宠鏀炬枡", Wheel_id, "鍏佽鏀炬枡",
- $"璇诲彇妗佹灦淇℃伅锛歕n杞﹁疆SN锛歿Wheel_id}\n杞瀷ID锛歿Wheel_Type}\n杞﹁疆鐘舵�侊細鍚堟牸" +
+ $"璇诲彇妗佹灦淇℃伅锛歕n杞﹁疆SN锛歿Wheel_id}\n杞瀷ID锛歿Wheel_Type}\n杞﹁疆鐘舵�侊細涓嶅悎鏍�" +
$"\n璇诲彇鎵樼洏鍏夌數淇″彿锛歿PalletSignal}" +
$"\n\n鍐欏叆妗佹灦淇℃伅锛歕n涓嬫枡浣嶅彿锛歿area}\n绗嚑涓溅杞細{(Stationinfo.quantity + 1)}\n鎵樼洏绫诲瀷锛�1\n鏄惁鍏佽涓嬫枡锛歵rue");
#endregion
@@ -759,7 +750,7 @@
VOLContext Context = new VOLContext();
Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(Context);
IVV_Mes_WorkinfoRepository workinfoRepository = new VV_Mes_WorkinfoRepository(Context);
- Work = workinfoRepository.Find(x => x.workOrder == stationinfo.Number && x.processCode == "17").FirstOrDefault();
+ Work = workinfoRepository.Find(x => x.workOrder == stationinfo.Number && x.processCode == "17").OrderByDescending(x => x.CreateTime).FirstOrDefault();
var task = agvtaskRepository.Find(x => x.agv_fromaddress == stationinfo.stationCode).FirstOrDefault();
if (task != null) return;
if (!string.IsNullOrEmpty(Work.area))
--
Gitblit v1.9.3