From 2e2b2a3efe2a5def011834daa43d71da9b3b5d00 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期三, 03 四月 2024 10:55:57 +0800
Subject: [PATCH] 优化逻辑
---
代码管理/PCS/WCS_Client/src/api/http.js | 2
代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/OutboundTask.cs | 295 +++++++++++-------------------------
代码管理/PCS/WCS_Server/WIDESEA_WCS/Jobs/Task/AutoTaskJob.cs | 4
代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/新文件夹/GetLocation.cs | 45 +++++
代码管理/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/HandleTask.cs | 2
代码管理/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs | 31 +++
代码管理/PCS/WCS_Server/WIDESEA_WCS/Jobs/equipment/PipelineJob.cs | 46 ++++-
代码管理/PCS/WCS_Server/WIDESEA_Entity/DomainModels/ToMES/VV_Mes_Workinfo.cs | 32 +++
代码管理/WMS/WMS_Client/src/api/http.js | 2
9 files changed, 238 insertions(+), 221 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Client/src/api/http.js" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Client/src/api/http.js"
index f6b7a14..8ecd457 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Client/src/api/http.js"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Client/src/api/http.js"
@@ -12,7 +12,7 @@
let loadingInstance;
let loadingStatus = false;
if (process.env.NODE_ENV == 'development') {
- axios.defaults.baseURL = 'http://192.168.12.101:8099/';
+ axios.defaults.baseURL = 'http://127.0.0.1:8099/';
}
else if (process.env.NODE_ENV == 'debug') {
axios.defaults.baseURL = 'http://192.168.12.101:8099/';
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_Entity/DomainModels/ToMES/VV_Mes_Workinfo.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_Entity/DomainModels/ToMES/VV_Mes_Workinfo.cs"
index 52669ae..f1dc241 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_Entity/DomainModels/ToMES/VV_Mes_Workinfo.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_Entity/DomainModels/ToMES/VV_Mes_Workinfo.cs"
@@ -159,6 +159,36 @@
[Editable(true)]
public string processCode { get; set; }
-
+ /// <summary>
+ ///瀹屾垚鏁伴噺
+ /// </summary>
+ [Display(Name = "瀹屾垚鏁伴噺")]
+ [Column(TypeName = "int")]
+ [Editable(true)]
+ public int? finishNum { get; set; }
+
+ /// <summary>
+ ///鍒涘缓鏃堕棿
+ /// </summary>
+ [Display(Name = "鍒涘缓鏃堕棿")]
+ [Column(TypeName = "datetime")]
+ public DateTime CreateTime { get; set; }
+
+ /// <summary>
+ ///瀹屾垚鏃堕棿
+ /// </summary>
+ [Display(Name = "瀹屾垚鏃堕棿")]
+ [Column(TypeName = "datetime")]
+ [Editable(true)]
+ public DateTime? FinishTime { get; set; }
+
+ /// <summary>
+ ///宸ュ崟鐘舵��
+ /// </summary>
+ [Display(Name = "宸ュ崟鐘舵��")]
+ [MaxLength(20)]
+ [Column(TypeName = "nvarchar(20)")]
+ [Editable(true)]
+ public string Status { get; set; }
}
}
\ No newline at end of file
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 9cc2340..95d9cba 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"
@@ -467,7 +467,11 @@
var AreaNr = (Int16)DBExtension.Read(details.Where(x => x.plcdetail_name == "W_AreaNr").First(), client);
if (AreaNr == 0)
+ {
client.WriteByOrder("W_Storage_update", true, name);//璐т綅鐘舵�佹洿鏂�
+ continue;
+ }
+
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());
@@ -543,6 +547,9 @@
var Request = (bool)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_Request_Load").First(), client);
if (!Request) continue;
+ var Area = client.ReadByOrder<Int16>("W_AreaNr", name);//璇诲彇璐т綅鍙蜂俊鎭�
+ if (Area != 0) continue;
+
var load_zone = (bool)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_load_zone").First(), client);
#region 璇诲彇妗佹灦淇℃伅
var Wheel_Type = DBExtension.Read(details.Where(x => x.plcdetail_name == "R_Wheel_Type").First(), client);//杞﹁疆绫诲瀷
@@ -580,7 +587,7 @@
#endregion
- var Stations = stationinfoRepository.Find(x => x.area == PipelineJob.area_code(name));
+ var Stations = stationinfoRepository.Find(x => x.area == PipelineJob.area_code(name)).OrderBy(x => x.lastUpdateTime).ToList();
var NGStation = "X01001003";
if (name == "2鍗曞厓涓嬫枡鍖�") NGStation = "X02001003";
@@ -720,6 +727,7 @@
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)
@@ -729,6 +737,7 @@
Stationinfo.location_state = LocationStateEnum.Abnormal.ToString();
Stationinfo.remark = "杞﹁疆鏁伴噺涓庡厜鐢典笉鍖归厤";
stationinfoRepository.Update(Stationinfo, true);
+ WriteDBLog.Error(name + "鎶ヨ", $"璐т綅缂栧彿锛歿Stationinfo.stationCode}锛涢敊璇俊鎭細{Stationinfo.remark}", "PCS");
}
#endregion
@@ -834,10 +843,30 @@
}
#region 璐т綅鏁伴噺涓庡厜鐢典笉鍖归厤锛屾姤璀�
+ //if (list.Count > 0 && MaterialSignal != 1)
+ // Pipeline_client.WriteByOrder("W_AlarmSignal", (Int16)2, name);//鎶ヨ
+ //else if (list.Count < 1 && MaterialSignal == 1)
+ // 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");
+ }
#endregion
//缂撳瓨鏋朵笂杞﹁疆鏁伴噺涓嶴N鍙锋暟閲忎笉涓�鑷�
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 925e098..90d8e64 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"
@@ -37,8 +37,8 @@
//EmptyTrayTask.task();
StationTask.CreateTask();
- //OutboundTask.CreateOutboundTask();
- OutboundTask_a.CreateOutboundTask();
+ OutboundTask.CreateOutboundTask();//浼樺寲鍚庡嚭搴撻�昏緫
+ //OutboundTask_a.CreateOutboundTask();
ReplaceTray.ReplaceTrayTask();
RestockHCJ.HCJGetBarcode();
EmptyTrayTask.CreateEmptyTrayTask();
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/equipment/PipelineJob.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/equipment/PipelineJob.cs"
index 64c0e42..8a8bfcc 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/equipment/PipelineJob.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/equipment/PipelineJob.cs"
@@ -77,7 +77,7 @@
///鏌ユ壘涓婃枡鍖虹殑璐т綅
- var Stations = stationinfoRepository.Find(x => x.area == area_code(number));
+ var Stations = stationinfoRepository.Find(x => x.area == area_code(number)).OrderBy(x => x.lastUpdateTime);//鏍规嵁鏃堕棿鍏堝悗鎺掑簭
//缂撳瓨鏋舵湭鍚敤绂佹妗佹灦杩涘叆
//foreach (var station in Stations)
//{
@@ -111,20 +111,25 @@
var details = plcRepository.Find(x => x.plcdetail_iotype == plc.plcinfo_iotyep && x.plcdetail_number == Station.stationCode).ToList();
var PalletSignal = (Int16)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_PalletSignal").First(), client);//璇诲彇鎵樼洏淇″彿:1:鏈�,2鏃�
var MaterialSignal = (Int16)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_MaterialSignal").First(), client);//璇诲彇璐х墿淇″彿:1:鏈�,2鏃�
+
+ var AreaNr = Gantry_client.ReadByOrder<Int16>("W_AreaNr", number);//璇诲彇璐т綅鍙蜂俊鎭�
if (PalletSignal == 1 && MaterialSignal == 1)
{
- 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);//鎵樼洏涓婄殑绗嚑涓溅杞�
- Gantry_client.WriteByOrder("W_Storage_Type", (Int16)1, number); //鎵樼洏绫诲瀷1-妯斁;2-绔栨斁
- Gantry_client.WriteByOrder("W_Wheel_Type", (Int16)Convert.ToInt16(QueryMateriel(Station.stationType) == null ? QueryMateriel1(Station.stationType).TypeId : QueryMateriel(Station.stationType).TypeId), number);//杞﹁疆绫诲瀷
- Gantry_client.WriteByOrder("W_Wheel_id", SNS[SNS.Length - 1], number);//杞﹁疆SN鍙�
- 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).TypeId == null ? QueryMateriel1(Station.stationType).TypeId : QueryMateriel(Station.stationType).TypeId)}" +
- $"\n杞﹁疆SN鍙凤細{SNS[SNS.Length - 1]}\nW_RequestUnload锛歵rue", "PCS");
- #endregion
+ if (AreaNr == 0)
+ {
+ 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);//鎵樼洏涓婄殑绗嚑涓溅杞�
+ Gantry_client.WriteByOrder("W_Storage_Type", (Int16)1, number); //鎵樼洏绫诲瀷1-妯斁;2-绔栨斁
+ Gantry_client.WriteByOrder("W_Wheel_Type", (Int16)Convert.ToInt16(QueryMateriel(Station.stationType) == null ? QueryMateriel1(Station.stationType).TypeId : QueryMateriel(Station.stationType).TypeId), number);//杞﹁疆绫诲瀷
+ Gantry_client.WriteByOrder("W_Wheel_id", SNS[SNS.Length - 1], number);//杞﹁疆SN鍙�
+ 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).TypeId == null ? QueryMateriel1(Station.stationType).TypeId : QueryMateriel(Station.stationType).TypeId)}" +
+ $"\n杞﹁疆SN鍙凤細{SNS[SNS.Length - 1]}\nW_RequestUnload锛歵rue", "PCS");
+ #endregion
+ }
}
else
{
@@ -174,10 +179,20 @@
//throw new Exception($"涓婃枡浣嶄俊鎭洿鏂板け璐ワ紒涓婃枡浣嶇紪鍙凤細{Station.stationCode}");
return;
}
+
+ #region 娓呯┖淇℃伅
+ Gantry_client.WriteByOrder("W_AreaNr", (Int16)0, number);//鍖哄煙璐т綅鍙�
+ Gantry_client.WriteByOrder("W_IndexNr", (Int16)0, number);//鎵樼洏涓婄殑绗嚑涓溅杞�
+ Gantry_client.WriteByOrder("W_Storage_Type", (Int16)0, number); //鎵樼洏绫诲瀷1-妯斁;2-绔栨斁
+ Gantry_client.WriteByOrder("W_Wheel_Type", (Int16)0, number);//杞﹁疆绫诲瀷
+ //Gantry_client.WriteByOrder("W_Wheel_id", SNS[SNS.Length - 1], number);//杞﹁疆SN鍙�
+ #endregion
+
Gantry_client.WriteByOrder("W_Storage_update", true, number);//璐т綅鐘舵�佹洿鏂�
#region 鏃ュ織璁板綍
WriteDBLog.Success("鍙栨枡瀹屾垚", $"鍐欏叆妗佹灦淇℃伅锛歕n璐т綅鐘舵�佹洿鏂帮細{true}\nW_RequestUnload锛歿false}", "PCS");
#endregion
+
PalletSignal = (Int16)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_PalletSignal").First(), client);//璇诲彇鎵樼洏淇″彿:1:鏈�,2鏃�
MaterialSignal = (Int16)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_MaterialSignal").First(), client);//璇诲彇璐х墿淇″彿:1:鏈�,2鏃�
if (Station.quantity > 0 && (PalletSignal != 1 || MaterialSignal != 1))
@@ -186,6 +201,7 @@
Station.remark = "杞﹁疆鏁伴噺澶т簬0锛屽厜鐢垫娴嬫棤鎵樼洏鎴栨棤杞﹁疆";
stationinfoRepository.Update(Station, true);
client.WriteByOrder("W_AlarmSignal", (Int16)2, number);//鎶ヨ
+ WriteDBLog.Error(number + "鎶ヨ", $"璐т綅缂栧彿锛歿Station.stationCode}锛涢敊璇俊鎭細{Station.remark}", "PCS");
}
else if (Station.quantity < 1 && MaterialSignal == 1)
{
@@ -193,6 +209,7 @@
Station.remark = "杞﹁疆鏁伴噺灏忎簬0锛屽厜鐢垫娴嬫湁杞﹁疆";
stationinfoRepository.Update(Station, true);
client.WriteByOrder("W_AlarmSignal", (Int16)2, number);//鎶ヨ
+ WriteDBLog.Error(number + "鎶ヨ", $"璐т綅缂栧彿锛歿Station.stationCode}锛涢敊璇俊鎭細{Station.remark}", "PCS");
}
}
}
@@ -336,6 +353,7 @@
Station.remark = "杞﹁疆鏁伴噺澶т簬0锛屽厜鐢垫娴嬫棤鎵樼洏鎴栨棤杞﹁疆";
stationinfoRepository.Update(Station, true);
client.WriteByOrder("W_AlarmSignal", (Int16)2, name);//鎶ヨ
+ WriteDBLog.Error(name + "鎶ヨ", $"璐т綅缂栧彿锛歿Station.stationCode}锛涢敊璇俊鎭細{Station.remark}", "PCS");
continue;
}
if (Station.location_state == LocationStateEnum.Stroge.ToString() && PalletSignal != 1)
@@ -344,6 +362,7 @@
Station.remark = "璐т綅鏈夎揣锛屽厜鐢垫娴嬫棤鎵樼洏";
stationinfoRepository.Update(Station, true);
client.WriteByOrder("W_AlarmSignal", (Int16)2, name);//鎶ヨ
+ WriteDBLog.Error(name + "鎶ヨ", $"璐т綅缂栧彿锛歿Station.stationCode}锛涢敊璇俊鎭細{Station.remark}", "PCS");
continue;
}
if (Station.location_state == LocationStateEnum.Empty.ToString() && (PalletSignal == 1 || MaterialSignal == 1))//绯荤粺璐т綅涓虹┖锛屽厜鐢垫娴嬫湁鏂�
@@ -352,6 +371,7 @@
Station.remark = "璐т綅鏃犺揣锛屽厜鐢垫娴嬫湁鏂�";
stationinfoRepository.Update(Station, true);
client.WriteByOrder("W_AlarmSignal", (Int16)2, name);//鎶ヨ
+ WriteDBLog.Error(name + "鎶ヨ", $"璐т綅缂栧彿锛歿Station.stationCode}锛涢敊璇俊鎭細{Station.remark}", "PCS");
continue;
}
//if (Station.quantity < 1 && MaterialSignal == 1)//绯荤粺璐т綅鏃犺溅杞紝鍏夌數妫�娴嬫湁杞﹁疆
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/OutboundTask.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/OutboundTask.cs"
index 0f45587..4f2348c 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/OutboundTask.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/OutboundTask.cs"
@@ -30,27 +30,38 @@
{
VOLContext context = new VOLContext();
Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(context);
- Idt_mes_headRepository mes_HeadRepository = new dt_mes_headRepository(context);
- Idt_mes_detailRepository mes_DetailRepository = new dt_mes_detailRepository(context);
Idt_inventoryRepository inventoryRepository = new dt_inventoryRepository(context);
Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(context);
+ IVV_Mes_WorkinfoRepository workinfoRepository = new VV_Mes_WorkinfoRepository(context);
- var mes_heads = mes_HeadRepository.Find(x => x.processCode == "28").OrderBy(x => x.expectedStartTime).ToList();
- //var mes_heads = mes_HeadRepository.Find(x => x.processCode == "28").OrderByDescending(x => x.CreateTime).ToList();
- foreach (var mes_head in mes_heads)
+ var Mes_Works = workinfoRepository.Find(x => x.processCode == "28").OrderBy(x => x.CreateTime).ToList();
+ foreach (var Mes_Work in Mes_Works)
{
- #region 鏍规嵁搴撳瓨鍏ュ簱鏃堕棿鏈�鏅氭煡璇�
- var inventory = inventoryRepository.Find(x => x.FigureNumber == mes_head.drawingNo).OrderByDescending(x => x.OnlineTime).FirstOrDefault();
+ var inventory = inventoryRepository.Find(x => x.SN == Mes_Work.SN).FirstOrDefault();
if (inventory != null)
{
- var Station = stationinfoRepository.Find(x => x.stationCode == inventory.stationCode).FirstOrDefault();
+ var Station = stationinfoRepository.Find(x => x.stationCode == inventory.stationCode).FirstOrDefault();//鏌ユ壘搴撳瓨璐т綅
if (Station != null)
{
- #region 瀛樺湪鍏ュ簱浠诲姟涓嶈兘鍑哄簱
- var InTask = stationinfoRepository.Find(x => x.line == Station.line && x.area == Station.area && x.location_state == LocationStateEnum.InBusy.ToString()).Any();
- if (InTask) continue;
+ dt_stationinfo stationinfo = null;
+
+ #region 搴撳尯涓�
+ if (Station.area == "1")
+ {
+ //鏌ユ壘褰撳墠璐т綅鍚屽垪鏄惁瀛樺湪鍏ュ簱浠诲姟
+ if (stationinfoRepository.Find(x => x.column == Station.column && x.area == "1" && x.location_state == LocationStateEnum.InBusy.ToString()).Any()) continue;
+
+ stationinfo = stationinfoRepository.Find(x => x.column == Station.column && x.enable && x.area == "1" && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).OrderBy(x => x.line).FirstOrDefault();
+ }
#endregion
- var stationinfo = stationinfoRepository.Find(x => x.line == Station.line && x.area == Station.area && x.enable && x.location_state == LocationStateEnum.Stroge.ToString()).OrderByDescending(x => x.column).FirstOrDefault();
+ else
+ {
+ //鏌ユ壘褰撳墠璐т綅鍚屽垪鏄惁瀛樺湪鍏ュ簱浠诲姟
+ if (stationinfoRepository.Find(x => x.line == Station.line && x.area == Station.area && x.location_state == LocationStateEnum.InBusy.ToString()).Any()) continue;
+
+ stationinfo = stationinfoRepository.Find(x => x.line == Station.line && x.area == Station.area && x.enable && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).OrderByDescending(x => x.column).FirstOrDefault();
+ }
+
if (stationinfo != null)
{
if (string.IsNullOrEmpty(stationinfo.bindSN))
@@ -59,10 +70,10 @@
stationinfo.location_state = "Abnormal";
stationinfoRepository.Update(stationinfo, true);
continue;
- //throw new Exception(stationinfo.stationCode + "杞﹁疆SN鍙蜂俊鎭紓甯�!");
}
- if (agvtaskRepository.Find(x => x.agv_fromaddress == stationinfo.stationCode).Any())
- continue;
+
+ if (agvtaskRepository.Find(x => x.agv_fromaddress == stationinfo.stationCode).Any()) continue;
+
List<string> lists = new List<string>();
var SNS = stationinfo.bindSN.Split(",");
foreach (var SN in SNS)
@@ -70,196 +81,80 @@
if (!string.IsNullOrEmpty(SN))
lists.Add(SN);
}
- foreach (var item in lists)
- {
- //var a = mes_DetailRepository.Find(x => x.jobID == mes_head.jobID /*&& x.SN == item*/).ToList();
- //var b = a.Where(x => x.SN == item).FirstOrDefault();
- if (mes_DetailRepository.Find(x => x.jobID == mes_head.jobID && x.SN == item).Any())
- {
- dt_agvtask agvtask = new dt_agvtask()
- {
- agv_fromaddress = stationinfo.stationCode,
- agv_id = Guid.NewGuid(),
- agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"),
- agv_grade = 2,
- agv_createtime = DateTime.Now,
- agv_taskstate = "Queue",
- agv_materielid = stationinfo.stationType,
- agv_qty = stationinfo.quantity,
- agv_tasktype = "TaskType_Outbound",
- agv_toaddress = "",
- agv_userid = "绯荤粺",
- bindSN = stationinfo.bindSN,
- jobID = mes_head.jobID,
- agv_worktype = Convert.ToInt32(mes_head.processCode),
- agv_materbarcode = mes_head.materialCode,
- agv_Traytype = stationinfo.tray_type,
- agv_TrayStatus = stationinfo.tray_status
- };
- stationinfo.location_state = LocationStateEnum.OutBusy.ToString();
- stationinfoRepository.Update(stationinfo, true);
- agvtaskRepository.Add(agvtask, true);
- WriteDBLog.Success("鍒涘缓鍑哄簱浠诲姟", $"浠诲姟缂栧彿锛歿agvtask.agv_tasknum}", "PCS");
- return;
- }
- }
- }
- var stationinfos = stationinfoRepository.Find(x => x.stationType == mes_head.drawingNo && x.line != Station.line && x.area == Station.area && x.location_state == "Stroge").OrderBy(x => x.line).ThenByDescending(x => x.column).ToList();
- foreach (var item in stationinfos)
- {
- if (item != null && stationinfo.enable)
+ #region 璐т綅杞﹁疆鍏ㄩ儴鍖呭惈鍦ㄥ伐鍗曞唴鍒欎笅鍙戜换鍔�
+ var count = 0;
+ foreach (var SN in lists)
{
- if (item.bindSN == null)
- {
- stationinfo.remark = "杞﹁疆SN鍙蜂俊鎭紓甯�";
- stationinfo.location_state = "Abnormal";
- stationinfoRepository.Update(stationinfo, true);
- continue;
- }
- if (agvtaskRepository.Find(x => x.agv_fromaddress == stationinfo.stationCode).Any())
- continue;
- List<string> lists = new List<string>();
- var SNS = stationinfo.bindSN.Split(",");
- foreach (var SN in SNS)
- {
- if (!string.IsNullOrEmpty(SN))
- lists.Add(SN);
- }
- foreach (var list in lists)
- {
- if (mes_DetailRepository.Find(x => x.jobID == mes_head.jobID && x.SN == list).Any())
- {
- dt_agvtask agvtask = new dt_agvtask()
- {
- agv_fromaddress = stationinfo.stationCode,
- agv_id = Guid.NewGuid(),
- agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"),
- agv_grade = 1,
- agv_createtime = DateTime.Now,
- agv_taskstate = "Queue",
- agv_materielid = stationinfo.stationType,
- agv_qty = stationinfo.quantity,
- jobID = mes_head.jobID,
- agv_tasktype = "TaskType_Outbound",
- agv_toaddress = "",
- agv_userid = "绯荤粺",
- bindSN = stationinfo.bindSN,
- agv_worktype = Convert.ToInt32(mes_head.processCode),
- agv_materbarcode = mes_head.materialCode,
- agv_Traytype = stationinfo.tray_type,
- agv_TrayStatus = stationinfo.tray_status
- };
- WriteDBLog.Success("鍒涘缓鍑哄簱浠诲姟", $"浠诲姟缂栧彿锛歿agvtask.agv_tasknum}", "PCS");
- agvtaskRepository.Add(agvtask, true);
- return;
- }
- }
- }
- }
+ //if (!workinfoRepository.Find(x => x.processCode == "28" && x.SN.Contains(SN)).Any()) return;
+ if (workinfoRepository.Find(x => x.processCode == "28" && x.SN.Contains(SN)).Any()) count++;
- #region MyRegion
- //if (stationinfo != null && stationinfo.enable)
- //{
- // if (stationinfo.bindSN == null)
- // throw new Exception(stationinfo.stationCode + "杞﹁疆SN鍙蜂俊鎭紓甯�!");
- // List<string> lists = new List<string>();
- // var SNS = stationinfo.bindSN.Split(",");
- // foreach (var SN in SNS)
- // {
- // if (!string.IsNullOrEmpty(SN))
- // lists.Add(SN);
- // }
- // foreach (var item in lists)
- // {
- // if (freeDB.Select<dt_mes_detail>().Where(x => x.jobID == mes_head.jobID && x.SN == item).Any())
- // {
- // dt_agvtask agvtask = new dt_agvtask()
- // {
- // agv_fromaddress = stationinfo.stationCode,
- // agv_id = Guid.NewGuid(),
- // agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"),
- // agv_grade = 1,
- // agv_createtime = DateTime.Now,
- // agv_taskstate = "Queue",
- // agv_materielid = stationinfo.stationType,
- // agv_qty = stationinfo.quantity,
- // agv_tasktype = "TaskType_Outbound",
- // agv_toaddress = "",
- // agv_userid = "绯荤粺",
- // bindSN = stationinfo.bindSN,
- // agv_worktype = Convert.ToInt32(mes_head.processCode),
- // agv_materbarcode = mes_head.materialCode,
- // agv_Traytype = stationinfo.tray_type,
- // agv_TrayStatus = stationinfo.tray_status
- // };
- // dt_stationinfo TargetLocation = GetEmptyLocation(stationinfoRepository);
- // if (TargetLocation != null)
- // {
- // agvtask.agv_taskstate = "Create";
- // agvtask.agv_toaddress = TargetLocation.stationCode;
- // TargetLocation.location_state = LocationStateEnum.Busy.ToString();
- // freeDB.Update(TargetLocation);
- // }
- // freeDB.Add(agvtask);
- // return;
- // }
- // }
- //}
- #endregion
+ }
+ if (count != lists.Count) continue;
+ dt_agvtask agvtask = new dt_agvtask()
+ {
+ agv_fromaddress = stationinfo.stationCode,
+ agv_id = Guid.NewGuid(),
+ agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"),
+ agv_grade = 2,
+ agv_createtime = DateTime.Now,
+ agv_taskstate = "Queue",
+ agv_materielid = stationinfo.stationType,
+ agv_qty = stationinfo.quantity,
+ agv_tasktype = "TaskType_Outbound",
+ agv_toaddress = "",
+ agv_userid = "绯荤粺",
+ bindSN = stationinfo.bindSN,
+ jobID = Mes_Work.jobID,
+ agv_worktype = Convert.ToInt32(Mes_Work.processCode),
+ agv_materbarcode = Mes_Work.materialCode,
+ agv_Traytype = stationinfo.tray_type,
+ agv_TrayStatus = stationinfo.tray_status
+ };
+ stationinfo.location_state = LocationStateEnum.OutBusy.ToString();
+ stationinfoRepository.Update(stationinfo, true);
+ agvtaskRepository.Add(agvtask, true);
+ WriteDBLog.Success("鍒涘缓鍑哄簱浠诲姟", $"浠诲姟缂栧彿锛歿agvtask.agv_tasknum}", "PCS");
+ continue;
+
+ #endregion
+
+ #region 璐т綅杞﹁疆鏈変竴涓寘鍚湪宸ュ崟鍐呭垯涓嬪彂浠诲姟
+ //foreach (var SN in lists)
+ //{
+ // if (mes_DetailRepository.Find(x => x.jobID == mes_head.jobID && x.SN == SN).Any())
+ // {
+ // dt_agvtask agvtask = new dt_agvtask()
+ // {
+ // agv_fromaddress = stationinfo.stationCode,
+ // agv_id = Guid.NewGuid(),
+ // agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"),
+ // agv_grade = 2,
+ // agv_createtime = DateTime.Now,
+ // agv_taskstate = "Queue",
+ // agv_materielid = stationinfo.stationType,
+ // agv_qty = stationinfo.quantity,
+ // agv_tasktype = "TaskType_Outbound",
+ // agv_toaddress = "",
+ // agv_userid = "绯荤粺",
+ // bindSN = stationinfo.bindSN,
+ // jobID = mes_head.jobID,
+ // agv_worktype = Convert.ToInt32(mes_head.processCode),
+ // agv_materbarcode = mes_head.materialCode,
+ // agv_Traytype = stationinfo.tray_type,
+ // agv_TrayStatus = stationinfo.tray_status
+ // };
+ // stationinfo.location_state = LocationStateEnum.OutBusy.ToString();
+ // stationinfoRepository.Update(stationinfo, true);
+ // agvtaskRepository.Add(agvtask, true);
+ // WriteDBLog.Success("鍒涘缓鍑哄簱浠诲姟", $"浠诲姟缂栧彿锛歿agvtask.agv_tasknum}", "PCS");
+ // continue;
+ // }
+ //}
+ #endregion
+ }
}
}
- #endregion
-
- #region MyRegion
- //var station = stationinfoRepository.Find(x => x.stationType == mes_head.drawingNo && x.line != x.line).OrderBy(x => x.line).ThenByDescending(x => x.column).FirstOrDefault();
- //bool ok = false;
- //List<string> list = new List<string>();
- //if (station != null && station.location_state == LocationStateEnum.Stroge.ToString() && station.enable)
- //{
- // var SNS = station.bindSN.Split(",");
- // foreach (var SN in SNS)
- // {
- // if (!string.IsNullOrEmpty(SN))
- // list.Add(SN);
- // }
- //}
- //foreach (var SN in list)
- //{
- // if (ok = freeDB.Select<dt_mes_detail>().Where(x => x.jobID == mes_head.jobID && x.SN == SN).Any()) continue;
- //}
- //if (ok)
- //{
- // dt_agvtask agvtask = new dt_agvtask()
- // {
- // agv_fromaddress = station.stationCode,
- // agv_id = Guid.NewGuid(),
- // agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"),
- // agv_grade = 1,
- // agv_createtime = DateTime.Now,
- // agv_taskstate = "Queue",
- // agv_materielid = station.stationType,
- // agv_qty = station.quantity,
- // agv_tasktype = "TaskType_Outbound",
- // agv_toaddress = "",
- // agv_userid = "绯荤粺",
- // bindSN = station.bindSN,
- // agv_worktype = Convert.ToInt32(mes_head.processCode),
- // agv_materbarcode = mes_head.materialCode,
- // agv_barcode = station.tray_type
- // };
- // dt_stationinfo TargetLocation = GetEmptyLocation(stationinfoRepository);
- // if (TargetLocation != null)
- // {
- // agvtask.agv_taskstate = "Create";
- // agvtask.agv_toaddress = TargetLocation.stationCode;
- // TargetLocation.location_state = LocationStateEnum.Busy.ToString();
- // freeDB.Update(TargetLocation);
- // }
- // freeDB.Add(agvtask);
- //}
- #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/\346\226\260\346\226\207\344\273\266\345\244\271/GetLocation.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/\346\226\260\346\226\207\344\273\266\345\244\271/GetLocation.cs"
index 6781e0e..9474e1d 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/\346\226\260\346\226\207\344\273\266\345\244\271/GetLocation.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/\346\226\260\346\226\207\344\273\266\345\244\271/GetLocation.cs"
@@ -66,7 +66,10 @@
var station = stationinfoRepository.FindFirst(x => x.stationCode == inventory.stationCode);
if (station.area == "1")
{
- TargetLocation = stationinfoRepository.Find(x => x.column == station.column && x.location_state == LocationStateEnum.Empty.ToString() && x.enable && x.area == inventory.area).OrderByDescending(x => x.line).FirstOrDefault();
+ //TargetLocation = stationinfoRepository.Find(x => x.column == station.column && x.location_state == LocationStateEnum.Empty.ToString() && x.enable && x.area == inventory.area).OrderByDescending(x => x.line).FirstOrDefault();
+
+ TargetLocation = stationinfoRepository.Find(x => x.line == station.line && x.location_state == LocationStateEnum.Empty.ToString() && x.enable && x.area == station.area).OrderBy(x => x.column).FirstOrDefault();//鎸夎瀛樻斁
+
if (TargetLocation != null)
{
if (!stationinfoRepository.Find(x => x.column == TargetLocation.column && x.area == TargetLocation.area /*&& x.enable*/ && x.location_state == LocationStateEnum.OutBusy.ToString()).Any())
@@ -92,7 +95,10 @@
{
if (TargetLocation.area == "1")
{
- TargetLocation = stationinfoRepository.Find(x => x.column == TargetLocation.column && x.location_state == LocationStateEnum.Empty.ToString() && x.enable && x.area == TargetLocation.area).OrderByDescending(x => x.line).FirstOrDefault();
+ //TargetLocation = stationinfoRepository.Find(x => x.column == TargetLocation.column && x.location_state == LocationStateEnum.Empty.ToString() && x.enable && x.area == TargetLocation.area).OrderByDescending(x => x.line).FirstOrDefault();
+
+ TargetLocation = stationinfoRepository.Find(x => x.line == TargetLocation.line && x.location_state == LocationStateEnum.Empty.ToString() && x.enable && x.area == TargetLocation.area).OrderBy(x => x.column).FirstOrDefault();//鎸夎瀛樻斁
+
if (TargetLocation != null)
{
if (!stationinfoRepository.Find(x => x.column == TargetLocation.column && x.area == TargetLocation.area /*&& x.enable*/ && x.location_state == LocationStateEnum.OutBusy.ToString()).Any())
@@ -111,6 +117,25 @@
}
#endregion
+ #region 瀵绘壘绌鸿揣浣�
+ var TargetLocations = stationinfoRepository.Find(x => x.location_state == LocationStateEnum.Empty.ToString() && x.enable && (x.area == "1" || x.area == "2" || x.area == "3" || x.area == "4")).OrderBy(x => x.line).ThenBy(x => x.column).ToList();
+ foreach (var Location in TargetLocations)
+ {
+ if (Location.area == "1")
+ {
+ if (stationinfoRepository.Find(x => x.column == Location.column && x.area == Location.area && x.stationType == stationinfo.stationType && x.location_state != LocationStateEnum.OutBusy.ToString()).Any()) return Location;
+ }
+ else
+ {
+ if (stationinfoRepository.Find(x => x.line == Location.line && x.area == Location.area && x.stationType == stationinfo.stationType && x.location_state != LocationStateEnum.OutBusy.ToString()).Any()) return Location;
+ }
+ }
+ //if (TargetLocation != null)
+ //{
+ // if (stationinfoRepository.Find(x => x.line == TargetLocation.line && x.column == 1 && x.stationType == stationinfo.stationType).Any()) return TargetLocation;
+ //}
+ #endregion
+
#region 鏈壘鍒板簱瀛樻垨褰撳墠搴撳瓨琛屽凡婊�,瀵绘壘鏂扮殑涓�琛�
//var area1 = string.IsNullOrEmpty(mesinfo.area) ? GetArea(mesinfo.quantity, e) : mesinfo.area;
//var area = string.IsNullOrEmpty(mesinfo.area) ? GetArea(mesinfo.quantity, stationinfo.tray_type) : mesinfo.area;
@@ -126,6 +151,22 @@
if (TargetLocation == null)
TargetLocation = stationinfoRepository.Find(x => x.line == 2 && x.location_state == LocationStateEnum.Empty.ToString() && x.enable && x.area == "1").OrderBy(x => x.column).FirstOrDefault();
}
+
+ #region 鏌ョ湅褰撳墠绌鸿揣浣嶅悗鏄惁瀛樺湪鏈夋枡
+ if (TargetLocation != null)
+ {
+ if (TargetLocation.area == "1")
+ {
+ //绗竴琛屼笉涓虹┖璐т綅鍒欎笉鑳芥斁缃浜岃
+ if (stationinfoRepository.Find(x => x.column == TargetLocation.column && x.area == TargetLocation.area && x.location_state != LocationStateEnum.Empty.ToString() && x.line == 1).Any()) TargetLocation = null;
+ }
+ else
+ {
+ if (stationinfoRepository.Find(x => x.line == TargetLocation.line && x.area == TargetLocation.area && x.location_state != LocationStateEnum.Empty.ToString()).Any()) TargetLocation = null;
+ }
+ }
+ #endregion
+
#endregion
if (TargetLocation == null) throw new Exception("搴撲綅宸叉弧");
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Client/src/api/http.js" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Client/src/api/http.js"
index eb0a016..0af90a4 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Client/src/api/http.js"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Client/src/api/http.js"
@@ -12,7 +12,7 @@
let loadingInstance;
let loadingStatus = false;
if (process.env.NODE_ENV == 'development') {
- axios.defaults.baseURL = 'http://192.168.12.101:8098/';
+ axios.defaults.baseURL = 'http://127.0.0.1:8098/';
}
else if (process.env.NODE_ENV == 'debug') {
axios.defaults.baseURL = 'http://192.168.12.101:8098/';
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/HandleTask.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/HandleTask.cs"
index cf72c64..71cfa50 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/HandleTask.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/HandleTask.cs"
@@ -171,6 +171,7 @@
station2.stationType = task.agv_materielid;
station2.tray_status = task.agv_TrayStatus;//妯斁/绔栨斁
station2.tray_type = task.agv_Traytype;
+ station2.lastUpdateTime=DateTime.Now;
stationinfoRepository.Update(station2, true);
}
else if (task.agv_taskstate == AGVTaskStateEnum.Complete.ToString())
@@ -207,6 +208,7 @@
//if (!station1.stationCode.Contains("X") && !station1.stationCode.Contains("S") && !station1.stationCode.Contains("W01001004") && !station1.stationCode.Contains("W01001005"))
// station1.tray_type = string.Empty;
}
+ station1.lastUpdateTime = DateTime.Now;
stationinfoRepository.Update(station1, true);
}
}
--
Gitblit v1.9.3