From 25724888bc329401891bf1600a8a83d8aae338b3 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期六, 27 四月 2024 18:37:37 +0800
Subject: [PATCH] 叠盘入库功能开发,空托入库逻辑优化
---
代码管理/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs | 438 +++++++++++++++++-------------------------------------
1 files changed, 139 insertions(+), 299 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 ae19956..c5d9223 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"
@@ -388,43 +388,21 @@
var NGStation = "X01001003";
if (name == "2鍗曞厓涓嬫枡鍖�") NGStation = "X02001003";
if (name == "3鍗曞厓涓嬫枡鍖�") NGStation = "X03001002";
- #region MyRegion
- //var Wheel_Type = DBExtension.Read(details.Where(x => x.plcdetail_name == "R_Wheel_Type").First(), client);//杞﹁疆绫诲瀷
- //var Wheel_id = client.ReadByOrder<string>("R_Wheel_id", name);//杞﹁疆SN鍙�
- //if (string.IsNullOrEmpty(Wheel_id)) continue;
- ////var Wheel_id = DBExtension.Read(details.Where(x => x.plcdetail_name == "R_Wheel_id").First(), client).ToString();
-
- //var mes_Detail = mes_DetailRepository.FindFirst(x => x.SN == Wheel_id);
- //if (mes_Detail == null)
- //{
- // #region 鏃ュ織璁板綍
- // WriteDBLog.Error(name, $"璇诲彇妗佹灦淇℃伅锛歕n杞﹁疆SN锛歿Wheel_id}\n\n鏈煡璇㈠埌宸ュ崟璇︽儏", "PCS");
- // #endregion
- // continue;
- //}
- //var mes_Head = mes_HeadRepository.FindFirst(x => x.jobID == mes_Detail.jobID);
- //if (mes_Head == null)
- //{
- // #region 鏃ュ織璁板綍
- // WriteDBLog.Error(name, $"璇诲彇妗佹灦淇℃伅锛歕n杞﹁疆SN锛歿Wheel_id}\n\n鏈煡璇㈠埌宸ュ崟澶磋〃", "PCS");
- // #endregion
- // continue;
- //}
- #endregion
var finished = (bool)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_load_finished").First(), client);//鏀炬枡瀹屾垚
var updatefinished = (bool)DBExtension.Read(details.Where(x => x.plcdetail_name == "W_Storage_update").First(), client);//璐т綅鐘舵�佹洿鏂�
#region 璐т綅鐘舵�佹洿鏂板浣�
- //if (!finished && updatefinished)
- //{
- // client.WriteByOrder("W_Storage_update", false, name);//璐т綅鐘舵�佹洿鏂�
- // #region 鏃ュ織璁板綍
- // WriteDBLog.Success(name + "璐т綅鐘舵�佹洿鏂板浣�", $"璇诲彇妗佹灦淇℃伅锛歕nR_load_finished锛歿finished}\n\n鍐欏叆妗佹灦淇℃伅锛歕nW_Storage_update锛歠alse", "PCS");
- // #endregion
- //}
+ if (!finished && updatefinished)
+ {
+ client.WriteByOrder("W_Storage_update", false, name);//璐т綅鐘舵�佹洿鏂�
+ #region 鏃ュ織璁板綍
+ //WriteDBLog.Success(name + "璐т綅鐘舵�佹洿鏂板浣�", $"璇诲彇妗佹灦淇℃伅锛歕nR_load_finished锛歿finished}\n\n鍐欏叆妗佹灦淇℃伅锛歕nW_Storage_update锛歿false}", "PCS");
+ WriteLog.Write_Log(name + "鏀炬枡瀹屾垚", name + "璐т綅鐘舵�佹洿鏂颁俊鍙峰浣�", "鎴愬姛锛�",
+ $"璇诲彇妗佹灦淇℃伅锛歕n鏀炬枡瀹屾垚淇″彿锛歿finished}\n\n鍐欏叆妗佹灦淇℃伅锛歕n璐т綅鐘舵�佹洿鏂颁俊鍙凤細{false}");
+ #endregion
+ }
#endregion
-
if (finished && !updatefinished)
{
@@ -450,24 +428,6 @@
#endregion
continue;
}
- #region MyRegion
- //var Detail = mes_DetailRepository.FindFirst(x => x.SN == Wheel_SN);
- //if (Detail == null)
- //{
- // #region 鏃ュ織璁板綍
- // WriteDBLog.Error(name, $"璇诲彇妗佹灦淇℃伅锛歕n杞﹁疆SN鍙凤細{Wheel_SN}\n\n鏈煡璇㈠埌宸ュ崟璇︽儏", "PCS");
- // #endregion
- // continue;
- //}
- //var Head = mes_HeadRepository.FindFirst(x => x.jobID == Detail.jobID && x.processCode == "17");
- //if (Head == null)
- //{
- // #region 鏃ュ織璁板綍
- // WriteDBLog.Error(name, $"璇诲彇妗佹灦淇℃伅锛歕n杞﹁疆SN鍙凤細{Wheel_SN}\n\n鏈煡璇㈠埌宸ュ崟澶磋〃{Detail.jobID}", "PCS");
- // #endregion
- // continue;
- //}
- #endregion
#endregion
@@ -478,88 +438,90 @@
continue;
}
+ #region 鍒ゆ柇鍖哄煙鍙锋槸鍚︿竴鑷�
+ var area = client.ReadByOrder<Int16>("place_prog", name);//鏀炬枡瀹屾垚鐨勫尯鍩熷彿
+
+ if (AreaNr != area)
+ {
+ Pipeline_client.WriteByOrder("W_AlarmSignal", (Int16)2, name);//鎶ヨ
+ //WriteDBLog.Error(name + "鎶ヨ", $"PCS鍖哄煙鍙凤細{AreaNr}锛涙鏋跺尯鍩熷彿锛歿area}閿欒淇℃伅锛歅CS鍖哄煙鍙蜂笌妗佹灦鍖哄煙鍙蜂笉涓�鑷达紒", "PCS");
+ WriteLog.Write_Log(name + "鏀炬枡瀹屾垚鍑洪敊", Wheel_SN, "鍒ゆ柇鍖哄煙鍙锋槸鍚︿竴鑷�", $"PCS鍖哄煙鍙凤細{AreaNr}锛沑n妗佹灦鍖哄煙鍙凤細{area}\n閿欒淇℃伅锛歅CS鍖哄煙鍙蜂笌妗佹灦鍖哄煙鍙蜂笉涓�鑷达紒");
+ continue;
+ }
+ #endregion
var areaCode = PipelineJob.area_code(name); //鏍规嵁涓嬫枡鍙e崟鍏冨悕鑾峰彇鍖哄煙浠g爜
- var station = stationinfoRepository.FindFirst(x => x.area == areaCode && x.stationCode.Substring(x.stationCode.Length - 1, 1) == AreaNr.ToString());
- if (station.quantity >= 5)
- throw new Exception($"涓嬫枡浣嶄俊鎭洿鏂板け璐ワ紒涓嬫枡浣嶈溅杞暟閲忓ぇ浜�5锛歿station.stationCode}");
- //station.bindSN = station.bindSN == string.Empty ? Wheel_id : station.bindSN + "," + Wheel_id;
- if (!string.IsNullOrEmpty(station.bindSN))
+ var station = stationinfoRepository.Find(x => x.area == areaCode && x.stationCode.Substring(x.stationCode.Length - 1, 1) == AreaNr.ToString()).FirstOrDefault();
+ if (station != null)
{
- if (station.bindSN.Contains(Wheel_SN))
- throw new Exception($"{station.stationCode}宸插瓨鍦ㄨ溅杞甋N鍙凤細{Wheel_SN}");
+ if (station.quantity >= 5)
+ {
+ Pipeline_client.WriteByOrder("W_AlarmSignal", (Int16)2, name);//鎶ヨ
+ WriteLog.Write_Log(name + "鏀炬枡瀹屾垚鍑洪敊", Wheel_SN, "杞﹁疆鏁伴噺宸叉弧锛�", $"鍖哄煙鍙凤細{AreaNr}锛沑n杞﹁疆鏁帮細{station.quantity}\n閿欒淇℃伅锛氬尯鍩熷彿杞﹁疆鏁伴噺宸叉弧锛�");
+ }
+
+ #region 鍒ゆ柇杞﹁疆鏁伴噺鏄惁涓�鑷�
+ var quantity = client.ReadByOrder<Int16>("pos_prog", name);//妗佹灦璁板綍鐨勮溅杞暟閲�
+
+ if (quantity != station.quantity + 1)
+ {
+ Pipeline_client.WriteByOrder("W_AlarmSignal", (Int16)2, name);//鎶ヨ
+ WriteLog.Write_Log(name + "鏀炬枡瀹屾垚鍑洪敊", Wheel_SN, "鍒ゆ柇杞﹁疆鏁伴噺鏄惁涓�鑷�", $"鍖哄煙鍙凤細{AreaNr}锛沑n妗佹灦杞﹁疆鏁帮細{quantity}\nPCS杞﹁疆鏁帮細{station.quantity + 1}\n閿欒淇℃伅锛歅CS鍖哄煙鍙蜂笌妗佹灦鍖哄煙鍙蜂笉涓�鑷达紒");
+ continue;
+ }
+ #endregion
+
+ if (!string.IsNullOrEmpty(station.bindSN))
+ {
+ if (station.bindSN.Contains(Wheel_SN))
+ throw new Exception($"{station.stationCode}宸插瓨鍦ㄨ溅杞甋N鍙凤細{Wheel_SN}");
+ }
+
+ station.bindSN = string.IsNullOrEmpty(station.bindSN) ? Wheel_SN : station.bindSN + "," + Wheel_SN;
+ station.billetID = string.IsNullOrEmpty(station.billetID) ? Mes_Work.billetID.ToString() : station.billetID + "," + Mes_Work.billetID;
+ station.quantity++;
+ if (station.quantity == 1)
+ {
+ station.stationType = Mes_Work.drawingNo;
+ station.Number = Mes_Work.workOrder;
+ station.heatNumber = Mes_Work.heatID;
+ station.tray_status = "StrogeTray";
+ }
+
+ var count = stationinfoRepository.Update(station, true);
+ if (count < 1)
+ throw new Exception($"涓嬫枡浣嶄俊鎭洿鏂板け璐ワ紒涓嬫枡浣嶇紪鍙凤細{station.stationCode}");
+
+ #region 娓呯┖缁欐鏋剁殑涓嬫枡淇℃伅
+ client.WriteByOrder("W_IndexNr", (Int16)0, name);//鎵樼洏涓婄殑绗嚑涓溅杞�
+ client.WriteByOrder("W_Storage_Type", (Int16)0, name);//鎵樼洏绫诲瀷1-妯斁;2-绔栨斁(鏆傛椂鍙湁妯斁鎵樼洏)
+ client.WriteByOrder("W_AreaNr", (Int16)0, name);//鍖哄煙璐т綅鍙�
+ client.WriteByOrder("W_Storage_update", true, name);//璐т綅鐘舵�佹洿鏂�
+ WriteLog.Write_Log(name + "鏀炬枡瀹屾垚", Wheel_SN, "鎴愬姛锛�",
+ $"璇诲彇妗佹灦淇℃伅锛歕n鏀炬枡瀹屾垚淇″彿锛歿finished}\n杞﹁疆SN锛歿Wheel_SN}\n杞瀷ID锛歿WheelType}\n涓嬫枡浣嶅彿锛歿AreaNr}\n\n" +
+ $"澶勭悊鍐欏叆妗佹灦淇℃伅锛歕n鍖哄煙璐т綅鍙凤細{0}\n鎵樼洏涓婄殑绗嚑涓溅杞細{0}\n鎵樼洏绫诲瀷锛歿0}\n\n" +
+ $"鍐欏叆妗佹灦淇℃伅锛歕n璐т綅鐘舵�佹洿鏂颁俊鍙凤細{true}\n鏄惁鍏佽涓嬫枡锛歿false}");
+ //WriteDBLog.Success(name + "妗佹灦涓嬫枡瀹屾垚",
+ // $"璇诲彇妗佹灦淇℃伅锛歕nR_load_finished锛歿finished}\n杞﹁疆SN锛歿Wheel_SN}\n杞瀷ID锛歿WheelType}\n涓嬫枡浣嶅彿锛歿AreaNr}\n\n" +
+ // $"澶勭悊鍐欏叆妗佹灦淇℃伅锛歕nW_AreaNr锛歿0}\nW_IndexNr锛歿0}\nW_Storage_Type锛歿0}\n\n" +
+ // $"鍐欏叆妗佹灦淇℃伅锛歕nW_Storage_update锛歿true}\nW_Enabl_Load锛歿false}", "PCS");
+ #endregion
+
+ #region 淇敼宸ュ崟鐘舵��
+ 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);
+ if (count < 1)
+ throw new Exception($"宸ュ崟瀛愯〃淇℃伅鏇存柊澶辫触锛佽溅杞甋N鍙凤細{Detail.SN}");
+ var Head = mes_HeadRepository.FindFirst(x => x.jobID == Detail.jobID);
+ Head.finishNum = Head.finishNum + 1;
+ count = mes_HeadRepository.Update(Head, true);
+ if (count < 1)
+ throw new Exception($"宸ュ崟澶磋〃淇℃伅鏇存柊澶辫触锛佸伐鍗曞彿锛歿Head.jobID}");
+ #endregion
}
-
- station.bindSN = string.IsNullOrEmpty(station.bindSN) ? Wheel_SN : station.bindSN + "," + Wheel_SN;
- station.billetID = string.IsNullOrEmpty(station.billetID) ? Mes_Work.billetID.ToString() : station.billetID + "," + Mes_Work.billetID;
- station.quantity++;
- if (station.quantity == 1)
- {
- station.stationType = Mes_Work.drawingNo;
- station.Number = Mes_Work.workOrder;
- station.heatNumber = Mes_Work.heatID;
- station.tray_status = "StrogeTray";
- }
- //else if (station.stationCode == NGStation)
- //{
- // station.heatNumber = string.IsNullOrEmpty(station.heatNumber) ? Mes_Work.heatID : station.heatNumber + "," + Mes_Work.heatID;
- //}
-
- var count = stationinfoRepository.Update(station, true);
- if (count < 1)
- throw new Exception($"涓嬫枡浣嶄俊鎭洿鏂板け璐ワ紒涓嬫枡浣嶇紪鍙凤細{station.stationCode}");
-
- #region 娓呯┖缁欐鏋剁殑涓嬫枡淇℃伅
- client.WriteByOrder("W_AreaNr", (Int16)0, name);//鍖哄煙璐т綅鍙�
- client.WriteByOrder("W_IndexNr", (Int16)0, name);//鎵樼洏涓婄殑绗嚑涓溅杞�
- client.WriteByOrder("W_Storage_Type", (Int16)0, name);//鎵樼洏绫诲瀷1-妯斁;2-绔栨斁(鏆傛椂鍙湁妯斁鎵樼洏)
- client.WriteByOrder("W_Storage_update", true, name);//璐т綅鐘舵�佹洿鏂�
- WriteLog.Write_Log(name + "鏀炬枡瀹屾垚", Wheel_SN, "鎴愬姛锛�",
- $"璇诲彇妗佹灦淇℃伅锛歕n鏀炬枡瀹屾垚淇″彿锛歿finished}\n杞﹁疆SN锛歿Wheel_SN}\n杞瀷ID锛歿WheelType}\n涓嬫枡浣嶅彿锛歿AreaNr}\n\n" +
- $"澶勭悊鍐欏叆妗佹灦淇℃伅锛歕n鍖哄煙璐т綅鍙凤細{0}\n鎵樼洏涓婄殑绗嚑涓溅杞細{0}\n鎵樼洏绫诲瀷锛歿0}\n\n" +
- $"鍐欏叆妗佹灦淇℃伅锛歕n璐т綅鐘舵�佹洿鏂颁俊鍙凤細{true}\n鏄惁鍏佽涓嬫枡锛歿false}");
- //WriteDBLog.Success(name + "妗佹灦涓嬫枡瀹屾垚",
- // $"璇诲彇妗佹灦淇℃伅锛歕nR_load_finished锛歿finished}\n杞﹁疆SN锛歿Wheel_SN}\n杞瀷ID锛歿WheelType}\n涓嬫枡浣嶅彿锛歿AreaNr}\n\n" +
- // $"澶勭悊鍐欏叆妗佹灦淇℃伅锛歕nW_AreaNr锛歿0}\nW_IndexNr锛歿0}\nW_Storage_Type锛歿0}\n\n" +
- // $"鍐欏叆妗佹灦淇℃伅锛歕nW_Storage_update锛歿true}\nW_Enabl_Load锛歿false}", "PCS");
- #endregion
-
-
- //client.WriteByOrder("W_Enabl_Load", false, name);//鏄惁鍏佽
-
- #region 淇敼宸ュ崟鐘舵��
- 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);
- if (count < 1)
- throw new Exception($"宸ュ崟瀛愯〃淇℃伅鏇存柊澶辫触锛佽溅杞甋N鍙凤細{Detail.SN}");
- var Head = mes_HeadRepository.FindFirst(x => x.jobID == Detail.jobID);
- Head.finishNum = Head.finishNum + 1;
- count = mes_HeadRepository.Update(Head, true);
- if (count < 1)
- throw new Exception($"宸ュ崟澶磋〃淇℃伅鏇存柊澶辫触锛佸伐鍗曞彿锛歿Head.jobID}");
- #endregion
-
- #region 鏃ュ織璁板綍
- //WriteDBLog.Success(name + "鏀炬枡瀹屾垚", $"璇诲彇妗佹灦淇℃伅锛歕n杞﹁疆SN锛歿Wheel_id}\n杞瀷ID锛歿Wheel_Type}\n涓嬫枡浣嶅彿锛歿AreaNr}" +
- // $"\n\n鍐欏叆妗佹灦淇℃伅锛歕nW_Storage_update锛歵rue" + $"\nW_Enabl_Load锛歠alse", "PCS");
- #endregion
}
-
- #region 璐т綅鐘舵�佹洿鏂板浣�
- finished = (bool)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_load_finished").First(), client);//鏀炬枡瀹屾垚
- updatefinished = (bool)DBExtension.Read(details.Where(x => x.plcdetail_name == "W_Storage_update").First(), client);//璐т綅鐘舵�佹洿鏂�
- if (!finished && updatefinished)
- {
- client.WriteByOrder("W_Storage_update", false, name);//璐т綅鐘舵�佹洿鏂�
- #region 鏃ュ織璁板綍
- //WriteDBLog.Success(name + "璐т綅鐘舵�佹洿鏂板浣�", $"璇诲彇妗佹灦淇℃伅锛歕nR_load_finished锛歿finished}\n\n鍐欏叆妗佹灦淇℃伅锛歕nW_Storage_update锛歿false}", "PCS");
- WriteLog.Write_Log(name + "鏀炬枡瀹屾垚", name + "璐т綅鐘舵�佹洿鏂颁俊鍙峰浣�", "鎴愬姛锛�",
- $"璇诲彇妗佹灦淇℃伅锛歕n鏀炬枡瀹屾垚淇″彿锛歿finished}\n\n鍐欏叆妗佹灦淇℃伅锛歕n璐т綅鐘舵�佹洿鏂颁俊鍙凤細{false}");
- #endregion
- }
- #endregion
var Request = (bool)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_Request_Load").First(), client);
if (!Request) continue;
@@ -585,39 +547,18 @@
WriteLog.Write_Log(name + "鐢宠鏀炬枡寮傚父", Wheel_id, "鏌ヨ鏈哄姞宸ュ伐鍗�", $"璇诲彇妗佹灦淇℃伅锛歕n杞﹁疆SN鍙凤細{Wheel_id}鏈煡璇㈠埌宸ュ崟淇℃伅\n鍐欏叆妗佹灦淇℃伅锛歕n鏄惁鍏佽涓嬫枡锛歿false}");
}
- #region MyRegion
- //var mes_Detail = mes_DetailRepository.FindFirst(x => x.SN == Wheel_id);
- //if (mes_Detail == null)
- //{
- // #region 鏃ュ織璁板綍
- // client.WriteByOrder("W_Enabl_Load", false, name);//淇″彿涓篺alse妗佹灦鍋滄杩涘叆
- // WriteDBLog.Error(name, $"璇诲彇妗佹灦淇℃伅锛歕n杞﹁疆SN锛歿Wheel_id}\n\n鏈煡璇㈠埌宸ュ崟璇︽儏", "PCS");
- // #endregion
- // continue;
- //}
- //var mes_Head = mes_HeadRepository.FindFirst(x => x.jobID == mes_Detail.jobID);
- //if (mes_Head == null)
- //{
- // #region 鏃ュ織璁板綍
- // client.WriteByOrder("W_Enabl_Load", false, name);//淇″彿涓篺alse妗佹灦鍋滄杩涘叆
- // WriteDBLog.Error(name, $"璇诲彇妗佹灦淇℃伅锛歕n杞﹁疆SN锛歿Wheel_id}\n\n鏈煡璇㈠埌宸ュ崟澶磋〃", "PCS");
- // #endregion
- // continue;
- //}
- #endregion
#endregion
var Stations = stationinfoRepository.Find(x => x.area == PipelineJob.area_code(name)).OrderBy(x => x.lastUpdateTime).ToList();
-
-
- //foreach (var station in Stations) //浠讳綍涓�涓笅鏂欎綅涓虹┖鎴栫鐢ㄦ椂,閮戒細鍋滄妗佹灦
- //{
- // if (!station.enable || station.location_state == LocationStateEnum.Empty.ToString())
- // client.WriteByOrder("W_Enabl_Load", false, name);//淇″彿涓篺alse妗佹灦鍋滄杩涘叆
- //}
+ #region 涓嬫枡浣嶆槸鍚︿负绌虹姸鎬佸悓姝ョ粰妗佹灦
+ foreach (var station in Stations)
+ {
+ client.WriteByOrder(station.stationCode, station.location_state != LocationStateEnum.Stroge.ToString(), name);
+ }
+ #endregion
#region MyRegion
//var currentAreaNr = (Int16)DBExtension.Read(details.Where(x => x.plcdetail_name == "W_Are00aNr").First(), client);
@@ -648,6 +589,8 @@
WriteLog.Write_Log(name + "鐢宠鏀炬枡", Wheel_id, "鐢宠鏀炬枡", $"璇诲彇妗佹灦淇℃伅锛歕n杞﹁疆SN锛歿Wheel_id}\n杞瀷ID锛歿Wheel_Type}\n杞﹁疆鐘舵�侊細{PartStatus}\n鏄惁杩涘叆涓嬫枡鍖猴細{load_zone}");
if (load_zone) continue;
#endregion
+
+ #region 鍚堟牸
if ((Int16)PartStatus == 1)
{
dt_stationinfo Stationinfo = null;
@@ -659,7 +602,6 @@
&& x.location_state == LocationStateEnum.Stroge.ToString()
&& x.quantity < 5
&& x.stationType == Work.drawingNo
- //&& x.tray_type == ((wheel == null ? wheel1.e : wheel.e) < 1100 ? "SmallTray" : "LargeTray")
&& x.Number == Work.workOrder
&& x.heatNumber == Work.heatID)
.OrderByDescending(x => x.quantity)
@@ -673,7 +615,6 @@
&& x.location_state == LocationStateEnum.Stroge.ToString()
&& x.quantity < 5
&& x.stationType == Work.drawingNo
- //&& x.tray_type == ((wheel == null ? wheel1.e : wheel.e) < 1100 ? "SmallTray" : "LargeTray")
&& x.Number == Work.workOrder)
.OrderByDescending(x => x.quantity)
.FirstOrDefault();
@@ -681,16 +622,6 @@
if (Stationinfo == null)
{
-
- #region 涓嬫枡浣嶆潯浠朵笉鍖归厤鐩存帴瑙﹀彂鍏ュ簱浠诲姟
- //var stationinfos = Stations.Where(x => x.enable && x.stationCode != NGStation && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).ToList();
- //foreach (var stationinfo in stationinfos)
- //{
- // agvtask(stationinfoRepository, stationinfo, (wheel == null ? wheel1.e : wheel.e), name == "3鍗曞厓涓嬫枡鍖�" ? "TaskType_OutsourceInbound" : "TaskType_Inbound");
- //}
- #endregion
-
-
#region 瑙﹀彂NG浠诲姟
var NG = Stations.Where(x => x.enable && x.stationCode == NGStation && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).FirstOrDefault();
if (NG != null)
@@ -702,13 +633,6 @@
Stationinfo = Stations.Where(x => x.enable && x.stationCode != NGStation && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity == 0).FirstOrDefault();
- #region MyRegion
- //var stationinfo = Stations.Where(x => x.enable && x.stationCode != NGStation && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).FirstOrDefault();
- //if (stationinfo != null)
- //{
- // agvtask(stationinfoRepository, mes_Head, stationinfo, (wheel == null ? wheel1.e : wheel.e), name == "3鍗曞厓涓嬫枡鍖�" ? "TaskType_OutsourceInbound" : "TaskType_Inbound");
- //}
- #endregion
}
if (Stationinfo != null)
@@ -731,7 +655,6 @@
#endregion
#region 鎵樼洏绫诲瀷涓嶄竴鑷撮渶鏇存崲鎵樼洏
- //if (Stationinfo.tray_type != ((wheel == null ? wheel1.e : wheel.e) < 1100 ? "SmallTray" : "LargeTray"))
if (Stationinfo.tray_type != "LargeTray" && (wheel == null ? wheel1.e : wheel.e) > 1100)
{
client.WriteByOrder("W_Enabl_Load", false, name);//淇″彿涓篺alse妗佹灦鍋滄杩涘叆
@@ -748,7 +671,6 @@
var MaterialSignal = (Int16)DBExtension.Read(Pipelinedetails.Where(x => x.plcdetail_name == "R_MaterialSignal").First(), Pipeline_client);//璇诲彇璐х墿淇″彿:1:鏈�,2鏃�
- //var Wheel_id = client.ReadByOrder<string>("R_Wheel_id", name);
if (PalletSignal == 1)
{
List<string> list = new List<string>();
@@ -763,25 +685,26 @@
}
#region 璐т綅鏁伴噺涓庡厜鐢典笉鍖归厤锛屾姤璀�
- if (list.Count > 0 && MaterialSignal != 1)
- {
- client.WriteByOrder("W_Enabl_Load", false, name);//淇″彿涓篺alse妗佹灦鍋滄杩涘叆
- Pipeline_client.WriteByOrder("W_AlarmSignal", (Int16)2, name);//鎶ヨ
- Stationinfo.location_state = LocationStateEnum.Abnormal.ToString();
- Stationinfo.remark = "杞﹁疆鏁伴噺涓庡厜鐢典笉鍖归厤";
- stationinfoRepository.Update(Stationinfo, true);
- WriteDBLog.Error(name + "鎶ヨ", $"璐т綅缂栧彿锛歿Stationinfo.stationCode}锛涢敊璇俊鎭細{Stationinfo.remark}", "PCS");
- //WriteDBLog.Error(name+"鐢宠涓嬫枡",$"{Stationinfo.stationCode}鐨勮揣浣�","PCS");
- }
- else if (list.Count < 1 && MaterialSignal == 1)
- {
- client.WriteByOrder("W_Enabl_Load", false, name);//淇″彿涓篺alse妗佹灦鍋滄杩涘叆
- Pipeline_client.WriteByOrder("W_AlarmSignal", (Int16)2, name);//鎶ヨ
- Stationinfo.location_state = LocationStateEnum.Abnormal.ToString();
- Stationinfo.remark = "杞﹁疆鏁伴噺涓庡厜鐢典笉鍖归厤";
- stationinfoRepository.Update(Stationinfo, true);
- WriteDBLog.Error(name + "鎶ヨ", $"璐т綅缂栧彿锛歿Stationinfo.stationCode}锛涢敊璇俊鎭細{Stationinfo.remark}", "PCS");
- }
+ //if (list.Count > 0 && MaterialSignal != 1)
+ //{
+ // client.WriteByOrder("W_Enabl_Load", false, name);//淇″彿涓篺alse妗佹灦鍋滄杩涘叆
+ // Pipeline_client.WriteByOrder("W_AlarmSignal", (Int16)2, name);//鎶ヨ
+ // Stationinfo.location_state = LocationStateEnum.Abnormal.ToString();
+ // Stationinfo.remark = "杞﹁疆鏁伴噺涓庡厜鐢典笉鍖归厤";
+ // stationinfoRepository.Update(Stationinfo, true);
+ // WriteDBLog.Error(name + "鎶ヨ", $"璐т綅缂栧彿锛歿Stationinfo.stationCode}锛涢敊璇俊鎭細{Stationinfo.remark}", "PCS");
+ // continue;
+ //}
+ //else if (list.Count < 1 && MaterialSignal == 1)
+ //{
+ // client.WriteByOrder("W_Enabl_Load", false, name);//淇″彿涓篺alse妗佹灦鍋滄杩涘叆
+ // Pipeline_client.WriteByOrder("W_AlarmSignal", (Int16)2, name);//鎶ヨ
+ // Stationinfo.location_state = LocationStateEnum.Abnormal.ToString();
+ // Stationinfo.remark = "杞﹁疆鏁伴噺涓庡厜鐢典笉鍖归厤";
+ // stationinfoRepository.Update(Stationinfo, true);
+ // WriteDBLog.Error(name + "鎶ヨ", $"璐т綅缂栧彿锛歿Stationinfo.stationCode}锛涢敊璇俊鎭細{Stationinfo.remark}", "PCS");
+ // continue;
+ //}
#endregion
@@ -819,44 +742,20 @@
var station = Stations.Where(x => x.enable && x.stationCode != NGStation).OrderBy(x => x.lastUpdateTime).FirstOrDefault();
agvtask(stationinfoRepository, station, Work, name == "3鍗曞厓涓嬫枡鍖�" ? "TaskType_OutsourceInbound" : "TaskType_Inbound");
}
-
- //var stationinfos = Stations.Where(x => x.enable && x.Number != Work.workOrder && x.stationCode != NGStation && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).ToList();
- //foreach (var stationinfo in stationinfos)
- //{
- // agvtask(stationinfoRepository, stationinfo, Work, name == "3鍗曞厓涓嬫枡鍖�" ? "TaskType_OutsourceInbound" : "TaskType_Inbound");
- //}
#endregion
}
}
+ #endregion
+
+ #region 涓嶅悎鏍�
else if ((Int16)PartStatus == 2)
{
- dt_stationinfo Stationinfo = null;
- //if (mes_Detail.heatID != null)
- //{
- // Stationinfo = Stations
- //.Where(x => x.enable
- //&& x.stationCode == NGStation
- //&& x.location_state == LocationStateEnum.Stroge.ToString()
- //&& x.quantity < 5
- //&& x.stationType == mes_Head.drawingNo
- //&& x.tray_type == ((wheel == null ? wheel1.e : wheel.e) < 1100 ? "SmallTray" : "LargeTray")
- //&& x.Number == mes_Detail.jobID
- //&& x.heatNumber == mes_Detail.heatID).FirstOrDefault();
- //}
- //else
- //{
- //var tray_type = "SmallTray";
- //if ((wheel == null ? wheel1.e : wheel.e) > 1100) tray_type = "LargeTray";
- Stationinfo = Stations
- .Where(x => x.enable
- && x.stationCode == NGStation
- && x.location_state == LocationStateEnum.Stroge.ToString()
- && x.quantity < 5
- && x.stationType == Work.drawingNo
- //&& x.tray_type == ((wheel == null ? wheel1.e : wheel.e) < 1100 ? "SmallTray" : "LargeTray")
- /*&& x.Number == mes_Detail.jobID*/).FirstOrDefault();
- //}
+ dt_stationinfo Stationinfo = Stations.Where(x => x.enable
+ && x.stationCode == NGStation
+ && x.location_state == LocationStateEnum.Stroge.ToString()
+ && x.quantity < 5
+ && x.stationType == Work.drawingNo).FirstOrDefault();
if (Stationinfo == null)
{
@@ -901,31 +800,25 @@
}
#region 璐т綅鏁伴噺涓庡厜鐢典笉鍖归厤锛屾姤璀�
+
//if (list.Count > 0 && MaterialSignal != 1)
+ //{
+ // client.WriteByOrder("W_Enabl_Load", false, name);//淇″彿涓篺alse妗佹灦鍋滄杩涘叆
// Pipeline_client.WriteByOrder("W_AlarmSignal", (Int16)2, name);//鎶ヨ
+ // Stationinfo.location_state = LocationStateEnum.Abnormal.ToString();
+ // Stationinfo.remark = "杞﹁疆鏁伴噺涓庡厜鐢典笉鍖归厤";
+ // stationinfoRepository.Update(Stationinfo, true);
+ // WriteDBLog.Error(name + "鎶ヨ", $"璐т綅缂栧彿锛歿Stationinfo.stationCode}锛涢敊璇俊鎭細{Stationinfo.remark}", "PCS");
+ //}
//else if (list.Count < 1 && MaterialSignal == 1)
+ //{
+ // client.WriteByOrder("W_Enabl_Load", false, name);//淇″彿涓篺alse妗佹灦鍋滄杩涘叆
// Pipeline_client.WriteByOrder("W_AlarmSignal", (Int16)2, name);//鎶ヨ
-
- if (list.Count > 0 && MaterialSignal != 1)
- {
- client.WriteByOrder("W_Enabl_Load", false, name);//淇″彿涓篺alse妗佹灦鍋滄杩涘叆
- Pipeline_client.WriteByOrder("W_AlarmSignal", (Int16)2, name);//鎶ヨ
- Stationinfo.location_state = LocationStateEnum.Abnormal.ToString();
- Stationinfo.remark = "杞﹁疆鏁伴噺涓庡厜鐢典笉鍖归厤";
- stationinfoRepository.Update(Stationinfo, true);
- WriteDBLog.Error(name + "鎶ヨ", $"璐т綅缂栧彿锛歿Stationinfo.stationCode}锛涢敊璇俊鎭細{Stationinfo.remark}", "PCS");
-
- //WriteDBLog.Error(name+"鐢宠涓嬫枡",$"{Stationinfo.stationCode}鐨勮揣浣�","PCS");
- }
- else if (list.Count < 1 && MaterialSignal == 1)
- {
- client.WriteByOrder("W_Enabl_Load", false, name);//淇″彿涓篺alse妗佹灦鍋滄杩涘叆
- Pipeline_client.WriteByOrder("W_AlarmSignal", (Int16)2, name);//鎶ヨ
- Stationinfo.location_state = LocationStateEnum.Abnormal.ToString();
- Stationinfo.remark = "杞﹁疆鏁伴噺涓庡厜鐢典笉鍖归厤";
- stationinfoRepository.Update(Stationinfo, true);
- WriteDBLog.Error(name + "鎶ヨ", $"璐т綅缂栧彿锛歿Stationinfo.stationCode}锛涢敊璇俊鎭細{Stationinfo.remark}", "PCS");
- }
+ // Stationinfo.location_state = LocationStateEnum.Abnormal.ToString();
+ // Stationinfo.remark = "杞﹁疆鏁伴噺涓庡厜鐢典笉鍖归厤";
+ // stationinfoRepository.Update(Stationinfo, true);
+ // WriteDBLog.Error(name + "鎶ヨ", $"璐т綅缂栧彿锛歿Stationinfo.stationCode}锛涢敊璇俊鎭細{Stationinfo.remark}", "PCS");
+ //}
#endregion
//缂撳瓨鏋朵笂杞﹁疆鏁伴噺涓嶴N鍙锋暟閲忎笉涓�鑷�
@@ -935,8 +828,6 @@
Stationinfo.remark = "杞﹁疆鏁伴噺涓嶴N鍙锋暟閲忎笉涓�鑷�";
stationinfoRepository.Update(Stationinfo, true);
continue;
- //鍐欏叆妗佹灦鎶ヨ淇″彿
- //throw new Exception("涓嬫枡浣嶈溅杞暟閲忎笌SN鍙锋暟閲忎笉涓�鑷达紝涓嬫枡浣嶇紪鍙凤細" + Stationinfo.stationCode);
}
var area = Convert.ToInt16(Stationinfo.stationCode.Substring(Stationinfo.stationCode.Length - 1, 1));
client.WriteByOrder("W_AreaNr", (Int16)area, name);//鍖哄煙璐т綅鍙�
@@ -955,59 +846,8 @@
}
}
}
- #region
- //var Stationinfo = Stations
- // .Where(x => x.enable
- // && x.location_state == LocationStateEnum.Stroge.ToString()
- // && x.quantity < 5
- // && x.stationType == PipelineJob.QueryMateriel(Wheel_Type)
- // && x.Number == mes_Detail.jobID
- // && x.heatNumber == mes_Detail.heatID).FirstOrDefault();
- //if (Stationinfo == null)
- // Stationinfo = Stations.Where(x => x.enable && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity == 0).FirstOrDefault();
- //if (Stationinfo != null)
- //{
-
- //}
-
- //List<string> StationCodes = new List<string>() { "X01001001", "X01001002", "X01001003" };
- //if (name == "2鍗曞厓涓嬫枡鍖�")
- // StationCodes = new List<string>() { "X02001001", "X02001002", "X02001003" };
- //if (name == "3鍗曞厓涓嬫枡鍖�")
- // StationCodes = new List<string>() { "X03001001", "X03001002" };
-
#endregion
- #region
- //for (int i = 0; i < StationCodes.Count - 1; i++)
- //{
- // var PartStatus = (Int32)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_PartStatus").First(), client);//1:ok;2:nok
- // string NG = StationCodes[StationCodes.Count - 1];//NG璐т綅
- // var station = stationinfoRepository.FindFirst(x => x.stationCode == StationCodes[i] && x.enable && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity < 5);
- // if (station == null) continue;
- // var Pipelinedetails = plcRepository.Find(x => x.plcdetail_iotype == Pipelineplc.plcinfo_iotyep && x.plcdetail_number == StationCodes[i]).ToList();
- // var PalletSignal = (Int16)DBExtension.Read(Pipelinedetails.Where(x => x.plcdetail_name == "R_PalletSignal").First(), client);//璇诲彇鎵樼洏淇″彿:1:鏈�,2鏃�
- // if (PalletSignal == 1)
- // {
- // if (PartStatus == 1 && NG != station.stationCode)
- // {
- // client.WriteByOrder("W_AreaNr", (Int16)i + 1, name);//鍖哄煙璐т綅鍙�
- // client.WriteByOrder("W_IndexNr", (Int16)station.quantity + 1, name);//鎵樼洏涓婄殑绗嚑涓溅杞�
- // client.WriteByOrder("W_Storage_Type", (Int16)1, name);//鎵樼洏绫诲瀷1-妯斁;2-绔栨斁(鏆傛椂鍙湁妯斁鎵樼洏)
- // client.WriteByOrder("W_Enabl_Load", true, name);//鏄惁鍏佽
- // return;
- // }
- // else if (PartStatus == 2 && NG == station.stationCode)
- // {
- // client.WriteByOrder("W_AreaNr", (Int16)i + 1, name);//鍖哄煙璐т綅鍙�
- // client.WriteByOrder("W_IndexNr", (Int16)station.quantity + 1, name);//鎵樼洏涓婄殑绗嚑涓溅杞�
- // client.WriteByOrder("W_Storage_Type", (Int16)1, name);//鎵樼洏绫诲瀷1-妯斁;2-绔栨斁(鏆傛椂鍙湁妯斁鎵樼洏)
- // client.WriteByOrder("W_Enabl_Load", true, name);//鏄惁鍏佽
- // return;
- // }
- // }
- //}
- #endregion
}
catch (Exception ex)
{
--
Gitblit v1.9.3