From febcd0c73b51b17f484ff9a9a189b1f85130c2f7 Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期二, 17 三月 2026 13:52:06 +0800
Subject: [PATCH] 更新自动门,新增切卷卷绕缓存架
---
wcs-server-hbf/WIDESEA_Common/PLCConst.cs | 2
wcs-server-hbf/WIDESEA_WCSServer/appsettings.json | 2
DB/20250811DB最新BF.sql | 0
wcs-server-hbf/WIDESEA_WCS/Jobs/RGV/AluminumCaseJob.cs | 324 ++++++++++++++++++++++++++++++++
wcs-server-hbf/WIDESEA_WCS/SchedulerExecute/AGV/AgvAndEquiWork_JLM.cs | 167 ++++++++++++----
wcs-server-hbf/WIDESEA_WCSServer/modified_data.json | 2
wcs-server-hbf/WIDESEA_WCS/SchedulerExecute/Equipment/HCJ_XHCD.cs | 40 +++
wcs-server-hbf/WIDESEA_WCS/Config/卷绕缓存架.json | 31 +++
8 files changed, 521 insertions(+), 47 deletions(-)
diff --git "a/DB/20250811DB\346\234\200\346\226\260BF.sql" "b/DB/20250811DB\346\234\200\346\226\260BF.sql"
new file mode 100644
index 0000000..43e786c
--- /dev/null
+++ "b/DB/20250811DB\346\234\200\346\226\260BF.sql"
Binary files differ
diff --git a/wcs-server-hbf/WIDESEA_Common/PLCConst.cs b/wcs-server-hbf/WIDESEA_Common/PLCConst.cs
index f6e1660..5b10642 100644
--- a/wcs-server-hbf/WIDESEA_Common/PLCConst.cs
+++ b/wcs-server-hbf/WIDESEA_Common/PLCConst.cs
@@ -12,6 +12,6 @@
public const string PLCName2FLKHCJ = "閾濆3缂撳瓨鏋朵簩妤�";
-
+ public const string PLCNameJR = "鍗风粫缂撳瓨鏋跺強鑷姩闂�";
}
}
diff --git "a/wcs-server-hbf/WIDESEA_WCS/Config/\345\215\267\347\273\225\347\274\223\345\255\230\346\236\266.json" "b/wcs-server-hbf/WIDESEA_WCS/Config/\345\215\267\347\273\225\347\274\223\345\255\230\346\236\266.json"
new file mode 100644
index 0000000..0f50610
--- /dev/null
+++ "b/wcs-server-hbf/WIDESEA_WCS/Config/\345\215\267\347\273\225\347\274\223\345\255\230\346\236\266.json"
@@ -0,0 +1,31 @@
+[
+ {
+ "HCJCenterName": "鍗风粫缂撳瓨鏋�",
+ "stationInfos": [
+ {
+ "HCJName": "姝f瀬鍗风粫缂撳瓨鏋�2",
+ "HCJCode": "ZJ-QJHCJ11",
+ "RPLCDB": [ "x=2;0", "x=2;1", "x=2;2", "x=2;3", "x=2;4", "x=2;5" ], //鐗╂枡鍏夌數1銆�2銆�3銆�4,鎵樼洏鍏夌數锛屾寜閽�
+ "WPLCDB": [ "s=2;0", "s=2;1", "s=2;2" ] //榛勭伅,缁跨伅,绾㈢伅
+ },
+ {
+ "HCJName": "璐熸瀬鍗风粫缂撳瓨鏋�2",
+ "HCJCode": "FJ-QJHCJ11",
+ "RPLCDB": [ "x=2;8", "x=2;9", "x=2;10", "x=2;11", "x=2;12", "x=2;13" ], //鐗╂枡鍏夌數1銆�2銆�3銆�4,鎵樼洏鍏夌數锛屾寜閽�
+ "WPLCDB": [ "s=2;8", "s=2;9", "s=2;10" ] //榛勭伅,缁跨伅,绾㈢伅
+ },
+ {
+ "HCJName": "璐熸瀬鍗风粫缂撳瓨鏋�1",
+ "HCJCode": "FJ-QJHCJ10",
+ "RPLCDB": [ "x=2;16", "x=2;17", "x=2;18", "x=2;19", "x=2;20", "x=2;21" ], //鐗╂枡鍏夌數1銆�2銆�3銆�4,鎵樼洏鍏夌數锛屾寜閽�
+ "WPLCDB": [ "s=2;16", "s=2;17", "s=2;18" ] //榛勭伅,缁跨伅,绾㈢伅
+ },
+ {
+ "HCJName": "姝f瀬鍗风粫缂撳瓨鏋�1",
+ "HCJCode": "ZJ-QJHCJ10",
+ "RPLCDB": [ "x=2;24", "x=2;25", "x=2;26", "x=2;27", "x=2;28", "x=2;29" ], //鐗╂枡鍏夌數1銆�2銆�3銆�4,鎵樼洏鍏夌數锛屾寜閽�
+ "WPLCDB": [ "s=2;24", "s=2;25", "s=2;26" ] //榛勭伅,缁跨伅,绾㈢伅
+ }
+ ]
+ }
+]
\ No newline at end of file
diff --git a/wcs-server-hbf/WIDESEA_WCS/Jobs/RGV/AluminumCaseJob.cs b/wcs-server-hbf/WIDESEA_WCS/Jobs/RGV/AluminumCaseJob.cs
index e0a83cf..78278e6 100644
--- a/wcs-server-hbf/WIDESEA_WCS/Jobs/RGV/AluminumCaseJob.cs
+++ b/wcs-server-hbf/WIDESEA_WCS/Jobs/RGV/AluminumCaseJob.cs
@@ -21,6 +21,12 @@
using HslCommunication;
using SqlSugar;
using WIDESEA_Core.Extensions;
+using static System.Collections.Specialized.BitVector32;
+using WIDESEA_WCS.WCSClient.Modbus;
+using static FreeSql.Internal.GlobalFilter;
+using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
+using System.Reflection.Metadata;
+using Dm;
namespace WIDESEA_WCS
{
@@ -32,6 +38,7 @@
{
FreeDB freeDB = new FreeDB();
static List<HCJCenterEqDB> centerEqDBList;
+ static List<HCJCenterEqDB> centerJRDBList;
private static object createTaskObj = new object();
public Task Execute(IJobExecutionContext context)
{
@@ -54,8 +61,321 @@
client.Connect();
return;
}
- //閾濆3缂撳瓨鏋朵笟鍔′綔涓�
- LKHCJdispatch();
+ if (client.PLCName.Contains("閾濆3"))
+ {
+ //閾濆3缂撳瓨鏋朵笟鍔′綔涓�
+ LKHCJdispatch();
+ }
+ else
+ {
+ //鍗风粫缂撳瓨鏋朵笟鍔′綔涓�
+ JRHCJdispatch();
+ }
+
+ }
+ /// <summary>
+ /// 鍗风粫缂撳瓨鏋朵笟鍔′綔涓�
+ /// </summary>
+ private void JRHCJdispatch()
+ {
+
+ //閾濆3缂撳瓨鏋舵惉杩�
+ PLCClient pLCClientJR = WCSService.Clients.Find(V => V.PLCName==PLCConst.PLCNameJR);
+ if (pLCClientJR != null)
+ {
+ string tsjJson = File.ReadAllText(AppContext.BaseDirectory + "/Config/鍗风粫缂撳瓨鏋�.json", Encoding.UTF8);
+ centerJRDBList = JsonConvert.DeserializeObject<List<HCJCenterEqDB>>(tsjJson);
+ if (centerJRDBList == null)
+ {
+ return;
+ }
+ PLCClient agvzzplc = WCSService.Clients.Find(v => v.PLCName == "缁勮AGV璋冨害");
+ UpdateJRHCJ(pLCClientJR);
+ #region 鍗风粫鍙枡
+ List<base_ware_location> locations = freeDB.Select<base_ware_location>()
+ .Where(x => (x.tpgd == 0 && x.gd1 == 0 && x.gd2 == 0 && x.gd3 == 0 && x.gd4 == 0 && x.status == 1 && x.task == 2 && x.logic_layer == "1" && x.location_state == "LocationState_Empty") && (x.upper_code.Contains("QJHCJ10") || x.upper_code.Contains("QJHCJ11")))
+ .ToList();
+ foreach (var item in locations)
+ {
+ if (item.geartype == "鏆傛棤")
+ {
+ WriteLog.GetLog().Write($"{item.upper_code}{item.geartype}---{DateTime.Now}", $"鍗风粫涓婃枡璇锋眰澶辫触");
+ continue;
+ }
+ List<base_routing_table> routing_table = freeDB.Select<base_routing_table>()
+ .Where(v => v.route_end == item.upper_code).ToList();
+ if (routing_table.Count > 0)//鏃犳枡鎵嶈兘鐢熸垚浠诲姟&& location_QJ.tpgd==0
+ {
+ List<string> route_begans = routing_table.Select(x => x.route_began).ToList();
+ base_ware_location ware_Location = freeDB.Select<base_ware_location>()
+ .Where(d => route_begans.Contains(d.upper_code) && d.location_state == "LocationState_Stored" && d.logic_col == 1 && d.tpgd == 1 && d.status == 1 && d.task == 2 && d.geartype == item.geartype).OrderBy(d => d.update_time).First();
+ if (ware_Location != null)
+ {
+ base_ware_location jkloction = ware_Location;
+ #region 璁板綍涓婃枡璇锋眰淇″彿
+ WriteLog.GetLog().Write($"{item.upper_code}涓婃枡璇锋眰---{DateTime.Now}", $"鍗风粫涓婃枡璇锋眰");
+ #endregion
+ //鍐嶆鍒ゆ柇鏄惁鏈変换鍔″瓨鍦�
+ dt_agvtask agvtaskOld = freeDB.Select<dt_agvtask>().Where(x => x.agv_toaddress == item.upper_code).First();
+ if (agvtaskOld != null && item.task == 2)
+ {
+ item.logic_col = 1;//璁剧疆鑹搧鐗╂枡
+ item.task = 1;//璁剧疆浠诲姟鐢熸垚1
+ var locationOffOld1 = freeDB.Update(item).UpdateColumns(t => new
+ {
+ t.logic_col,
+ t.task
+ }).ExecuteAffrows();
+ continue;
+ }
+ dt_agvtask agvtask = new dt_agvtask()
+ {
+ agv_id = Guid.NewGuid(),
+ agv_tasknum = "KH-" + IdenxManager.GetTaskNo(),
+ agv_fromaddress = jkloction.upper_code,
+ agv_toaddress = item.upper_code,
+ agv_code = "缁勮AGV璋冨害",
+ agv_remark = "鍒囧嵎涓婃枡鍛煎彨",
+ agv_taskstate = AGVTaskStateEnum.Create.ToString(),
+ agv_tasktype = AGVTaskTypeEnum.TaskType_Outbound.ToString(),
+ agv_worktype = 1,//宸ヤ綔绫诲瀷
+ agv_materielid = "",
+ agv_qty = 1,
+ agv_createtime = DateTime.Now,
+ agv_grade = 0,//浠诲姟浼樺厛绾�
+ agv_userid = "WCS",
+ agv_barcode = ""
+ };
+ item.logic_col = 1;//璁剧疆鑹搧鐗╂枡
+ item.task = 1;//璁剧疆浠诲姟鐢熸垚1
+ var locationOff1 = freeDB.Update(item).UpdateColumns(t => new
+ {
+ t.logic_col,
+ t.task
+ }).ExecuteAffrows();
+ jkloction.logic_col = 1;//璁剧疆鑹搧鐗╂枡
+ jkloction.task = 1;//璁剧疆浠诲姟鐢熸垚1
+ var locationOff2 = freeDB.Update(jkloction).UpdateColumns(t => new
+ {
+ t.logic_col,
+ t.task
+ }).ExecuteAffrows();
+ freeDB.Add(agvtask);
+ }
+ else
+ {
+ WriteLog.GetLog().Write($"{item.upper_code}鏈壘鍒版弧瓒抽�佸線鍒囧嵎鐨勬瀬搴撴枡---{DateTime.Now}", $"鍗风粫涓婃枡璇锋眰澶辫触");
+ }
+ }
+ }
+ #endregion
+ }
+ }
+ private void UpdateJRHCJ(PLCClient client)
+ {
+ ModbusTcpNet ModbusPLCClient = client.ModbusPLCClient.ModbusTcpNetClient;
+ var stationList = centerJRDBList.FirstOrDefault(t => client.PLCName.Contains(t.HCJCenterName));
+ foreach (var item in stationList.stationInfos)
+ {
+ base_ware_location location = freeDB.Select<base_ware_location>()
+ .Where(x => x.upper_code == item.HCJCode)
+ .First();
+ ////Console.WriteLine($"{station.stationCode}------{DateTime.Now}");
+ if (location == null)
+ {
+ continue;
+ }
+ string wlgd1DB = item.RPLCDB[0];//鐗╂枡鍏夌數1鐘舵�佷俊鍙风偣浣�
+ string wlgd2DB = item.RPLCDB[1];//鐗╂枡鍏夌數2鐘舵�佷俊鍙风偣浣�
+ string wlgd3DB = item.RPLCDB[2];//鐗╂枡鍏夌數3鐘舵�佷俊鍙风偣浣�
+ string wlgd4DB = item.RPLCDB[3];//鐗╂枡鍏夌數4鐘舵�佷俊鍙风偣浣�
+ string tpgdDB = item.RPLCDB[4];//鎵樼洏鍏夌數鐘舵�佷俊鍙风偣浣�
+ string buttonDB = item.RPLCDB[5];//鎸夐挳鐘舵�佷俊鍙风偣浣�
+
+ ////纭鎸夐挳(缁胯壊)
+ OperateResult<bool> R_TBR_XT1 = ModbusPLCClient.ReadBool(buttonDB);
+ OperateResult<bool> R_TBR_XT2 = ModbusPLCClient.ReadBool(buttonDB);
+ WriteLog.GetLog().Write($"{item.HCJName}缂撳瓨鏋�,杩炴帴{R_TBR_XT1.IsSuccess}{R_TBR_XT2.IsSuccess}", "鍗风粫缂撳瓨鏋�");
+ if (!R_TBR_XT1.IsSuccess && !R_TBR_XT2.IsSuccess)
+ {
+ //Console.WriteLine($"-{ModbusPLCClient.IpAddress}---{station.stationCode}----{ButtonEnsureDB}--------false--{R_TBR_XT.Message}----------------");
+ location.location_state = LocationStateEnum.LocationState_Close.ToString();
+ location.tpgd = -1;
+ location.update_time = DateTime.Now;
+ location.wireless_time = DateTime.Now;
+ var locationOff = freeDB.Update(location).UpdateColumns(t => new
+ {
+ t.location_state,
+ t.tpgd,
+ t.update_time,
+ t.wireless_time
+ }).ExecuteAffrows();
+ continue;
+ }
+ OperateResult<bool> ButtonEnsure1 = ModbusPLCClient.ReadBool(buttonDB);
+ OperateResult<bool> ButtonEnsure2 = ModbusPLCClient.ReadBool(buttonDB);
+ //鎵樼洏鍏夌數鐘舵��
+ OperateResult<bool> tpgdstate1 = ModbusPLCClient.ReadBool(tpgdDB);
+ OperateResult<bool> tpgdstate2 = ModbusPLCClient.ReadBool(tpgdDB);
+ //鐗╂枡鍏夌數1鐘舵��
+ OperateResult<bool> wlgd1state1 = ModbusPLCClient.ReadBool(wlgd1DB);
+ OperateResult<bool> wlgd1state2 = ModbusPLCClient.ReadBool(wlgd1DB);
+ //鐗╂枡鍏夌數2鐘舵��
+ OperateResult<bool> wlgd2state1 = ModbusPLCClient.ReadBool(wlgd2DB);
+ OperateResult<bool> wlgd2state2 = ModbusPLCClient.ReadBool(wlgd2DB);
+ //鐗╂枡鍏夌數3鐘舵��
+ OperateResult<bool> wlgd3state1 = ModbusPLCClient.ReadBool(wlgd3DB);
+ OperateResult<bool> wlgd3state2 = ModbusPLCClient.ReadBool(wlgd3DB);
+ //鐗╂枡鍏夌數4鐘舵��
+ OperateResult<bool> wlgd4state1 = ModbusPLCClient.ReadBool(wlgd4DB);
+ OperateResult<bool> wlgd4state2 = ModbusPLCClient.ReadBool(wlgd4DB);
+ //鏍规嵁璇诲埌鐨凱LC淇℃伅锛岃疆璇㈡洿鏂版暟鎹簱淇℃伅
+ location.update_time = DateTime.Now;
+ location.wireless_time = DateTime.Now;
+ if (ButtonEnsure1.IsSuccess)
+ {
+ location.logic_layer = ButtonEnsure1.Content ? "1" : "0";
+ }
+ if (ButtonEnsure2.IsSuccess)
+ {
+ location.logic_layer = ButtonEnsure2.Content ? "1" : "0";
+ }
+ if (tpgdstate1.IsSuccess)
+ {
+ location.tpgd = !tpgdstate1.Content ? 1 : 0;
+ }
+ if (tpgdstate2.IsSuccess)
+ {
+ location.tpgd = !tpgdstate2.Content ? 1 : 0;
+ }
+ #region 鐗╂枡鍏夌數1
+ if (wlgd1state1.IsSuccess)
+ {
+ location.gd1 = !wlgd1state1.Content ? 1 : 0; ;
+ }
+ if (wlgd1state2.IsSuccess)
+ {
+ location.gd1 = !wlgd1state2.Content ? 1 : 0; ;
+ }
+ #endregion
+ #region 鐗╂枡鍏夌數2
+ if (wlgd2state1.IsSuccess)
+ {
+ location.gd2 = !wlgd2state1.Content ? 1 : 0; ;
+ }
+ if (wlgd2state2.IsSuccess)
+ {
+ location.gd2 = !wlgd2state2.Content ? 1 : 0; ;
+ }
+ #endregion
+ #region 鐗╂枡鍏夌數3
+ if (wlgd3state1.IsSuccess)
+ {
+ location.gd3 = !wlgd3state1.Content ? 1 : 0; ;
+ }
+ if (wlgd3state2.IsSuccess)
+ {
+ location.gd3 = !wlgd3state2.Content ? 1 : 0; ;
+ }
+ #endregion
+ #region 鐗╂枡鍏夌數4
+ if (wlgd4state1.IsSuccess)
+ {
+ location.gd4 = !wlgd4state1.Content ? 1 : 0; ;
+ }
+ if (wlgd4state2.IsSuccess)
+ {
+ location.gd4 = !wlgd4state2.Content ? 1 : 0; ;
+ }
+ #endregion
+ string LampYellowDB = item.WPLCDB[0];//榛勭伅淇″彿鐐逛綅
+ string LampGreenDB = item.WPLCDB[1];//缁跨伅淇″彿鐐逛綅
+ string LampRedDB = item.WPLCDB[2];//绾㈢伅淇″彿鐐逛綅
+
+ //璐ф灦瀛樺湪浠诲姟浠诲姟鏃�
+ if (location.tpgd == 1)
+ {
+ location.location_state = LocationStateEnum.LocationState_Stored.ToString();
+ OperateResult<bool> Yellow1 = ModbusPLCClient.ReadBool(LampYellowDB);
+ OperateResult<bool> Yellow2 = ModbusPLCClient.ReadBool(LampYellowDB);
+ if (location.logic_col == 2)
+ {
+ ModbusPLCClient.Write(LampRedDB, true); //绾㈢伅
+ ModbusPLCClient.Write(LampRedDB, true); //绾㈢伅
+ }
+ if (location.task == 1 && (Yellow1.Content || Yellow2.Content))
+ {
+ //ModbusPLCClient.Write(LampGreenDB, true); //缁跨伅
+ //ModbusPLCClient.Write(LampGreenDB, true); //缁跨伅
+ ModbusPLCClient.Write(LampYellowDB, false); //榛勭伅
+ ModbusPLCClient.Write(LampYellowDB, false); //榛勭伅
+ }
+ else if(location.task == 1 && (!Yellow1.Content || !Yellow2.Content))
+ {
+ //ModbusPLCClient.Write(LampGreenDB, true); //缁跨伅
+ //ModbusPLCClient.Write(LampGreenDB, true); //缁跨伅
+ ModbusPLCClient.Write(LampYellowDB, true); //榛勭伅
+ ModbusPLCClient.Write(LampYellowDB, true); //榛勭伅
+ }
+ else
+ {
+ ModbusPLCClient.Write(LampYellowDB, true); //榛勭伅
+ ModbusPLCClient.Write(LampYellowDB, true); //榛勭伅
+ ModbusPLCClient.Write(LampGreenDB, false); //缁跨伅
+ ModbusPLCClient.Write(LampGreenDB, false); //缁跨伅
+ ModbusPLCClient.Write(LampRedDB, false); //绾㈢伅
+ ModbusPLCClient.Write(LampRedDB, false); //绾㈢伅
+ }
+ }
+ else
+ {
+ location.location_state = LocationStateEnum.LocationState_Empty.ToString();
+ OperateResult<bool> Yellow1 = ModbusPLCClient.ReadBool(LampYellowDB);
+ OperateResult<bool> Yellow2 = ModbusPLCClient.ReadBool(LampYellowDB);
+ if (location.logic_col == 2)
+ {
+ ModbusPLCClient.Write(LampRedDB, true); //绾㈢伅
+ ModbusPLCClient.Write(LampRedDB, true); //绾㈢伅
+ }
+
+ if (location.task == 1 && (Yellow1.Content || Yellow2.Content))
+ {
+ ModbusPLCClient.Write(LampGreenDB, true); //缁跨伅
+ ModbusPLCClient.Write(LampGreenDB, true); //缁跨伅
+ ModbusPLCClient.Write(LampYellowDB, false); //榛勭伅
+ ModbusPLCClient.Write(LampYellowDB, false); //榛勭伅
+ }
+ else if (location.task == 1 && (!Yellow1.Content || !Yellow2.Content))
+ {
+ ModbusPLCClient.Write(LampGreenDB, true); //缁跨伅
+ ModbusPLCClient.Write(LampGreenDB, true); //缁跨伅
+ ModbusPLCClient.Write(LampYellowDB, true); //榛勭伅
+ ModbusPLCClient.Write(LampYellowDB, true); //榛勭伅
+ }
+ else
+ {
+ ModbusPLCClient.Write(LampYellowDB, false); //榛勭伅
+ ModbusPLCClient.Write(LampYellowDB, false); //榛勭伅
+ ModbusPLCClient.Write(LampGreenDB, false); //缁跨伅
+ ModbusPLCClient.Write(LampGreenDB, false); //缁跨伅
+ ModbusPLCClient.Write(LampRedDB, false); //绾㈢伅
+ ModbusPLCClient.Write(LampRedDB, false); //绾㈢伅
+ }
+ }
+
+ var executeAffrows = freeDB.Update(location).UpdateColumns(t => new
+ {
+ t.location_state,
+ t.logic_layer,
+ t.update_time,
+ t.wireless_time,
+ t.tpgd,
+ t.gd1,
+ t.gd2,
+ t.gd3,
+ t.gd4
+ }).ExecuteAffrows();
+ }
}
private void LKHCJdispatch()
{
diff --git a/wcs-server-hbf/WIDESEA_WCS/SchedulerExecute/AGV/AgvAndEquiWork_JLM.cs b/wcs-server-hbf/WIDESEA_WCS/SchedulerExecute/AGV/AgvAndEquiWork_JLM.cs
index d6554dc..07afd84 100644
--- a/wcs-server-hbf/WIDESEA_WCS/SchedulerExecute/AGV/AgvAndEquiWork_JLM.cs
+++ b/wcs-server-hbf/WIDESEA_WCS/SchedulerExecute/AGV/AgvAndEquiWork_JLM.cs
@@ -20,6 +20,7 @@
{
PLCClient agvjrplc = WCSService.Clients.Find(v => v.PLCName == "缁勮AGV璋冨害");
PLCClient oiplc1F = WCSService.Clients.Find(v => v.PLCName == PLCConst.PLCName1FLKHCJ);
+ PLCClient oiplcJR = WCSService.Clients.Find(v => v.PLCName == PLCConst.PLCNameJR);
#region 鏃犵嚎io妯″潡 104鍗风粫涓帶 寮�闂ㄤ俊鍙蜂紶閫�
int comErr = 0;//鑷姩闂ㄦ帀绾� "鎷嗗寘闂村嵎甯橀棬139", "娑傚竷姝h礋鏋佸嵎甯橀棬142",
@@ -44,37 +45,95 @@
OperateResult<bool> R_comErr = agvjrplc.SiemensPLCClient.SiemensS7NetClient.ReadBool("DB1004." + doorOpen);
if (!R_comErr.IsSuccess)
{
+ comErr += 30;
+ doorCode += 30;
+ doorState += 30;
+ doorOpen += 30;
continue;
+ }
+
+ string doorStart = "";//寮�闂�
+ string doorOff = "";//鍏抽棬
+ string doorStarted = "";//寮�闂ㄥ埌浣�
+ string doorOffed = "";//鍏抽棬鍒颁綅
+ switch (item)
+ {
+
+ case "璐熸瀬搴撳墠闂�":
+ doorStart = "s=2;11";
+ doorOff = "s=2;12";
+ doorStarted = "x=2;14";
+ doorOffed = "x=2;15";
+ break;
+ case "璐熸瀬搴撳悗闂�":
+ doorStart = "s=2;27";
+ doorOff = "s=2;28";
+ doorStarted = "x=2;30";
+ doorOffed = "x=2;31";
+ break;
+ case "姝f瀬搴撳悗闂�":
+ doorStart = "s=2;19";
+ doorOff = "s=2;20";
+ doorStarted = "x=2;22";
+ doorOffed = "x=2;23";
+ break;
}
//AGV璇锋眰寮�闂�
if (R_comErr.Content)
{
- Dictionary<string, string> Doorsignal = new Dictionary<string, string>();
- Doorsignal.Add("R_comErr", R_comErr.Content.ToString());//true
- Doorsignal.Add("DoorName", item.ToString());//item.ToString()
- string wificont = WIFIAPIInvoke.Doorsignal(Doorsignal);
- WebResponseContent wificontent = JsonConvert.DeserializeObject<WebResponseContent>(wificont);
- //if (item == "缁勮椋庨搩闂ㄥ墠闂�")
- //{
- // Console.WriteLine(wificontent.Status);
- //}
- if (wificontent.Status)
+ if ((item == "璐熸瀬搴撳墠闂�" || item == "璐熸瀬搴撳悗闂�" || item == "姝f瀬搴撳悗闂�") && oiplcJR != null)//
{
- //if (item == "缁勮椋庨搩闂ㄥ墠闂�")
- //{
- // Console.WriteLine(Convert.ToUInt16(wificontent.Data) );
- //}
- if (Convert.ToBoolean(wificontent.Data) == false)//鑷姩闂ㄦ帀绾�
+ OperateResult JROpenJLM1 = oiplcJR.ModbusPLCClient.ModbusTcpNetClient.Write(doorStart, true);
+ OperateResult JROpenJLM2 = oiplcJR.ModbusPLCClient.ModbusTcpNetClient.Write(doorStart, true);
+ OperateResult JROpenJLM3 = oiplcJR.ModbusPLCClient.ModbusTcpNetClient.Write(doorOff, false);
+ OperateResult JROpenJLM4 = oiplcJR.ModbusPLCClient.ModbusTcpNetClient.Write(doorOff, false);
+ if (JROpenJLM1.IsSuccess || JROpenJLM2.IsSuccess || JROpenJLM3.IsSuccess || JROpenJLM4.IsSuccess)
+ {
+ OperateResult<bool> JRJLMOpen1 = oiplcJR.ModbusPLCClient.ModbusTcpNetClient.ReadBool(doorStarted);
+ OperateResult<bool> JRJLMOpen2 = oiplcJR.ModbusPLCClient.ModbusTcpNetClient.ReadBool(doorStarted);
+ if (JRJLMOpen1.Content || JRJLMOpen2.Content)//寮�闂ㄥ埌浣�
+ {
+ OperateResult W_stationDockSteps = agvjrplc.SiemensPLCClient.SiemensS7NetClient.Write("DB1004." + (doorState), Convert.ToUInt16(2));
+ }
+ else//闂ㄦ湭鍒颁綅
+ {
+ OperateResult W_stationDockSteps = agvjrplc.SiemensPLCClient.SiemensS7NetClient.Write("DB1004." + (doorState), Convert.ToUInt16(3));
+ }
+ }
+ else
{
OperateResult W_stationDockSteps = agvjrplc.SiemensPLCClient.SiemensS7NetClient.Write("DB1004." + (comErr), true);
}
- else if (Convert.ToUInt16(wificontent.Data) == 2)//寮�闂ㄥ埌浣�
+ }
+ else
+ {
+ Dictionary<string, string> Doorsignal = new Dictionary<string, string>();
+ Doorsignal.Add("R_comErr", R_comErr.Content.ToString());//true
+ Doorsignal.Add("DoorName", item.ToString());//item.ToString()
+ string wificont = WIFIAPIInvoke.Doorsignal(Doorsignal);
+ WebResponseContent wificontent = JsonConvert.DeserializeObject<WebResponseContent>(wificont);
+ //if (item == "缁勮椋庨搩闂ㄥ墠闂�")
+ //{
+ // Console.WriteLine(wificontent.Status);
+ //}
+ if (wificontent.Status)
{
- OperateResult W_stationDockSteps = agvjrplc.SiemensPLCClient.SiemensS7NetClient.Write("DB1004." + (doorState), Convert.ToUInt16(wificontent.Data));
- }
- else if (Convert.ToUInt16(wificontent.Data) == 3)//闂ㄦ湭鍒颁綅
- {
- OperateResult W_stationDockSteps = agvjrplc.SiemensPLCClient.SiemensS7NetClient.Write("DB1004." + (doorState), Convert.ToUInt16(wificontent.Data));
+ //if (item == "缁勮椋庨搩闂ㄥ墠闂�")
+ //{
+ // Console.WriteLine(Convert.ToUInt16(wificontent.Data) );
+ //}
+ if (Convert.ToBoolean(wificontent.Data) == false)//鑷姩闂ㄦ帀绾�
+ {
+ OperateResult W_stationDockSteps = agvjrplc.SiemensPLCClient.SiemensS7NetClient.Write("DB1004." + (comErr), true);
+ }
+ else if (Convert.ToUInt16(wificontent.Data) == 2)//寮�闂ㄥ埌浣�
+ {
+ OperateResult W_stationDockSteps = agvjrplc.SiemensPLCClient.SiemensS7NetClient.Write("DB1004." + (doorState), Convert.ToUInt16(wificontent.Data));
+ }
+ else if (Convert.ToUInt16(wificontent.Data) == 3)//闂ㄦ湭鍒颁綅
+ {
+ OperateResult W_stationDockSteps = agvjrplc.SiemensPLCClient.SiemensS7NetClient.Write("DB1004." + (doorState), Convert.ToUInt16(wificontent.Data));
+ }
}
}
}
@@ -92,26 +151,54 @@
//else
//{
// WIDESEA_Common.Tools.WriteLog.GetLog("鏂紑寮�闂ㄤ俊鍙�").Write($"Info锛歿item}+{DateTime.Now}", "鏂紑寮�闂ㄤ俊鍙�");
- //AGV涓嶇粰寮�闂ㄤ俊鍙风殑鏃跺�� 鏂紑寮�闂ㄤ俊鍙�
- Dictionary<string, string> Doorsigna1 = new Dictionary<string, string>();
- Doorsigna1.Add("R_comErr", R_comErr.Content.ToString());
- Doorsigna1.Add("DoorName", item.ToString());
- string wificont = WIFIAPIInvoke.Doorsignal(Doorsigna1);
- WebResponseContent wificontent2 = JsonConvert.DeserializeObject<WebResponseContent>(wificont);
- if (wificontent2.Status)
+ if ((item == "璐熸瀬搴撳墠闂�" || item == "璐熸瀬搴撳悗闂�" || item == "姝f瀬搴撳悗闂�") && oiplcJR != null)
{
- if (Convert.ToBoolean(wificontent2.Data) == false)//鑷姩闂ㄦ帀绾�
+ //AGV涓嶇粰寮�闂ㄤ俊鍙风殑鏃跺�� 鏂紑寮�闂ㄤ俊鍙�
+ OperateResult JROpenJLM1 = oiplcJR.ModbusPLCClient.ModbusTcpNetClient.Write(doorStart, false);
+ OperateResult JROpenJLM2 = oiplcJR.ModbusPLCClient.ModbusTcpNetClient.Write(doorStart, false);
+ //OperateResult JROpenJLM3 = oiplcJR.ModbusPLCClient.ModbusTcpNetClient.Write(doorOff, true);
+ //OperateResult JROpenJLM4 = oiplcJR.ModbusPLCClient.ModbusTcpNetClient.Write(doorOff, true);
+ if (JROpenJLM1.IsSuccess || JROpenJLM2.IsSuccess)
+ {
+ OperateResult<bool> JRJLMOpen1 = oiplcJR.ModbusPLCClient.ModbusTcpNetClient.ReadBool(doorOffed);
+ OperateResult<bool> JRJLMOpen2 = oiplcJR.ModbusPLCClient.ModbusTcpNetClient.ReadBool(doorOffed);
+ if (JRJLMOpen1.Content || JRJLMOpen2.Content)//鍏抽棬鍒颁綅
+ {
+ OperateResult W_stationDockSteps = agvjrplc.SiemensPLCClient.SiemensS7NetClient.Write("DB1004." + (doorState), Convert.ToUInt16(1));
+ }
+ else//闂ㄦ湭鍒颁綅
+ {
+ OperateResult W_stationDockSteps = agvjrplc.SiemensPLCClient.SiemensS7NetClient.Write("DB1004." + (doorState), Convert.ToUInt16(3));
+ }
+ }
+ else
{
OperateResult W_stationDockSteps = agvjrplc.SiemensPLCClient.SiemensS7NetClient.Write("DB1004." + (comErr), true);
}
- ////else if (Convert.ToUInt16(wificontent2.Data) == 1)//鍏抽棬鍒颁綅
- ////{
- //// OperateResult W_stationDockSteps = agvjrplc.SiemensPLCClient.SiemensS7NetClient.Write("DB1004." + (doorState), Convert.ToUInt16(wificontent2.Data));
- ////}
- else
+ }
+ else
+ {
+ //AGV涓嶇粰寮�闂ㄤ俊鍙风殑鏃跺�� 鏂紑寮�闂ㄤ俊鍙�
+ Dictionary<string, string> Doorsigna1 = new Dictionary<string, string>();
+ Doorsigna1.Add("R_comErr", R_comErr.Content.ToString());
+ Doorsigna1.Add("DoorName", item.ToString());
+ string wificont = WIFIAPIInvoke.Doorsignal(Doorsigna1);
+ WebResponseContent wificontent2 = JsonConvert.DeserializeObject<WebResponseContent>(wificont);
+ if (wificontent2.Status)
{
- //鍏抽棬鏈埌浣�
- OperateResult W_stationDockSteps = agvjrplc.SiemensPLCClient.SiemensS7NetClient.Write("DB1004." + (doorState), Convert.ToUInt16(wificontent2.Data));
+ if (Convert.ToBoolean(wificontent2.Data) == false)//鑷姩闂ㄦ帀绾�
+ {
+ OperateResult W_stationDockSteps = agvjrplc.SiemensPLCClient.SiemensS7NetClient.Write("DB1004." + (comErr), true);
+ }
+ ////else if (Convert.ToUInt16(wificontent2.Data) == 1)//鍏抽棬鍒颁綅
+ ////{
+ //// OperateResult W_stationDockSteps = agvjrplc.SiemensPLCClient.SiemensS7NetClient.Write("DB1004." + (doorState), Convert.ToUInt16(wificontent2.Data));
+ ////}
+ else
+ {
+ //鍏抽棬鏈埌浣�
+ OperateResult W_stationDockSteps = agvjrplc.SiemensPLCClient.SiemensS7NetClient.Write("DB1004." + (doorState), Convert.ToUInt16(wificontent2.Data));
+ }
}
}
//}
@@ -136,11 +223,11 @@
OperateResult<bool> JLMOpen = oiplc1F.ModbusPLCClient.ModbusTcpNetClient.ReadBool("x=2;8612");
if (JLMOpen.Content)//寮�闂ㄥ埌浣�
{
- OperateResult W_stationDockSteps = agvjrplc.SiemensPLCClient.SiemensS7NetClient.Write("DB1004." + (RKState), 2);
+ OperateResult W_stationDockSteps = agvjrplc.SiemensPLCClient.SiemensS7NetClient.Write("DB1004." + (RKState), Convert.ToUInt16(2));
}
else//闂ㄦ湭鍒颁綅
{
- OperateResult W_stationDockSteps = agvjrplc.SiemensPLCClient.SiemensS7NetClient.Write("DB1004." + (RKState), 3);
+ OperateResult W_stationDockSteps = agvjrplc.SiemensPLCClient.SiemensS7NetClient.Write("DB1004." + (RKState), Convert.ToUInt16(3));
}
}
else
@@ -157,11 +244,11 @@
OperateResult<bool> JLMOpen = oiplc1F.ModbusPLCClient.ModbusTcpNetClient.ReadBool("x=2;8613");
if (JLMOpen.Content)//鍏抽棬鍒颁綅
{
- OperateResult W_stationDockSteps = agvjrplc.SiemensPLCClient.SiemensS7NetClient.Write("DB1004." + (RKState), 1);
+ OperateResult W_stationDockSteps = agvjrplc.SiemensPLCClient.SiemensS7NetClient.Write("DB1004." + (RKState), Convert.ToUInt16(1));
}
else//闂ㄦ湭鍒颁綅
{
- OperateResult W_stationDockSteps = agvjrplc.SiemensPLCClient.SiemensS7NetClient.Write("DB1004." + (RKState), 3);
+ OperateResult W_stationDockSteps = agvjrplc.SiemensPLCClient.SiemensS7NetClient.Write("DB1004." + (RKState), Convert.ToUInt16(3));
}
}
else
diff --git a/wcs-server-hbf/WIDESEA_WCS/SchedulerExecute/Equipment/HCJ_XHCD.cs b/wcs-server-hbf/WIDESEA_WCS/SchedulerExecute/Equipment/HCJ_XHCD.cs
index e7f1702..4bd2767 100644
--- a/wcs-server-hbf/WIDESEA_WCS/SchedulerExecute/Equipment/HCJ_XHCD.cs
+++ b/wcs-server-hbf/WIDESEA_WCS/SchedulerExecute/Equipment/HCJ_XHCD.cs
@@ -31,6 +31,10 @@
double doorState_zz = 24.0;//缂撳瓨鏋剁墿鏂欑姸鎬侊紙1锛氱┖浣嶏紝2:绌烘墭鐩橈紝3锛氭弧鎵樼洏锛�
double gdState_zz = 26.0;//棰勭暀
+ double comErr_JR = 9570.0;//鏄惁鎺夌嚎
+ double doorCode_JR = 9572.0;//缂撳瓨鏋禝D
+ double doorState_JR = 9594.0;//缂撳瓨鏋剁墿鏂欑姸鎬侊紙1锛氱┖浣嶏紝2:绌烘墭鐩橈紝3锛氭弧鎵樼洏锛�
+
double comErr_zj = 0.0;
double doorCode_zj = 2.0;
double doorState_zj = 24.0;
@@ -40,7 +44,9 @@
try
{
- List<base_ware_location> base_Ware_Locations_zz = locRepository.Find(t => t.upper_code.Contains("JK") || t.upper_code.Contains("QJ") || t.upper_code.Contains("GFHCJ")).OrderBy(t => t.order_num).ToList();
+ List<base_ware_location> base_Ware_Locations_zz = locRepository.Find(t =>( t.upper_code.Contains("JK") || t.upper_code.Contains("QJ") || t.upper_code.Contains("GFHCJ")) && !t.upper_code.Contains("QJHCJ10") && !t.upper_code.Contains("QJHCJ11")).OrderBy(t => t.order_num).ToList();
+
+ List<base_ware_location> base_Ware_Locations_JR = locRepository.Find(t =>t.upper_code.Contains("QJHCJ10") || t.upper_code.Contains("QJHCJ11")).OrderBy(t => t.order_num).ToList();
List<base_ware_location> base_Ware_Locations_zj = locRepository.Find(t => t.upper_code.Contains("ZJ-BC") || t.upper_code.Contains("ZJ-TB")).OrderBy(t => t.order_num).ToList();
@@ -260,8 +266,38 @@
doorState_fj += 30;
}
+ foreach (var item in base_Ware_Locations_JR)//鍗风粫杞﹂棿
+ {
+ if (agvzzplc == null)
+ {
+ break;
+ }
- // WIDESEA_Common.Tools.WriteLog.GetLog("淇″彿浼犻��").Write($"Info锛歿DateTime.Now}", "淇″彿浼犻��");
+ bool R_HCJ_ComErr_zz = false;
+ if (item.location_state == "LocationState_Close" || item.tpgd == -1)
+ {
+ R_HCJ_ComErr_zz = true;
+ }
+ if (item.tpgd == 0)
+ {
+ OperateResult W_HCJ_FullState = agvzzplc.SiemensPLCClient.SiemensS7NetClient.Write("DB1003." + doorState_JR, Convert.ToInt16(1));
+ }
+ else if (item.tpgd == 1)
+ {
+ OperateResult W_HCJ_FullState = agvzzplc.SiemensPLCClient.SiemensS7NetClient.Write("DB1003." + doorState_JR, Convert.ToInt16(3));
+ }
+ else if (item.tpgd == -1)
+ {
+ OperateResult W_HCJ_FullState = agvzzplc.SiemensPLCClient.SiemensS7NetClient.Write("DB1003." + doorState_JR, Convert.ToInt16(-1));
+ }
+ OperateResult W_HCJ_StationCode = agvzzplc.SiemensPLCClient.SiemensS7NetClient.Write("DB1003." + doorCode_JR, item.upper_code.ToString());
+ OperateResult W_HCJ_ComErr = agvzzplc.SiemensPLCClient.SiemensS7NetClient.Write("DB1003." + comErr_JR, R_HCJ_ComErr_zz);
+
+ comErr_JR += 30;
+ doorCode_JR += 30;
+ doorState_JR += 30;
+ }
+ // WIDESEA_Common.Tools.WriteLog.GetLog("淇″彿浼犻��").Write($"Info锛歿DateTime.Now}", "淇″彿浼犻��");
}
catch (Exception)
{
diff --git a/wcs-server-hbf/WIDESEA_WCSServer/appsettings.json b/wcs-server-hbf/WIDESEA_WCSServer/appsettings.json
index ef6ef84..b4de9fa 100644
--- a/wcs-server-hbf/WIDESEA_WCSServer/appsettings.json
+++ b/wcs-server-hbf/WIDESEA_WCSServer/appsettings.json
@@ -15,7 +15,7 @@
//P@ssw0rd
"Connection": {
"DBType": "MsSql",
- "DbConnectionString": "Data Source=192.168.20.248;Initial Catalog=JMYW_WCSDB;Persist Security Info=True;User ID=sa1;Password=123456;Connect Timeout=500;",
+ "DbConnectionString": "Data Source=127.0.0.1;Initial Catalog=JMYW_WCSDB;Persist Security Info=True;User ID=sa;Password=123456;Connect Timeout=500;",
"RedisConnectionString": "127.0.0.1,Password=123456,SyncTimeout=15000",
"UseRedis": "false"
},
diff --git a/wcs-server-hbf/WIDESEA_WCSServer/modified_data.json b/wcs-server-hbf/WIDESEA_WCSServer/modified_data.json
index 895c1a4..1e06532 100644
--- a/wcs-server-hbf/WIDESEA_WCSServer/modified_data.json
+++ b/wcs-server-hbf/WIDESEA_WCSServer/modified_data.json
@@ -1 +1 @@
-{"MM":"456","logtime":"2024-09-27"}
\ No newline at end of file
+{"MM":"456","logtime":"2026-03-12"}
\ No newline at end of file
--
Gitblit v1.9.3