From 346e8eafb9e91deb770d098ba5456aa533c015a1 Mon Sep 17 00:00:00 2001
From: Admin <Admin@ADMIN>
Date: 星期六, 28 三月 2026 12:36:43 +0800
Subject: [PATCH] 最新
---
项目代码/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/WMSTaskService.cs | 105 +++++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 91 insertions(+), 14 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/WMSTaskService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/WMSTaskService.cs"
index f3a9c86..e2681a5 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/WMSTaskService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/WMSTaskService.cs"
@@ -110,6 +110,7 @@
task.Grade = 1;
task.Creater = "WMS";
task.CreateDate = DateTime.Now;
+ task.WMStaskid = transfer.barCode;
task.deviceuuid = transfer.device.uuid;
_unitOfWorkManage.BeginTran();
@@ -157,23 +158,44 @@
ApiResponse apiResponse = new ApiResponse();
try
{
- //IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "1002");
- //if (device == null) return apiResponse.ErrorResponse("WCS鏈兘鑾峰彇鍒板簱鍙e疄渚�");
- //CommonConveyorLine conveyorLine = (CommonConveyorLine)device;
+
Dictionary<string, int> portStatusDict = new Dictionary<string, int>();
foreach (string DeStateName in datas)
{
- //鏆傛椂鏁版嵁
- portStatusDict[DeStateName] = 1;
+ string DeciceCodes = "1003";
+ if (DeStateName.StartsWith("C")) DeciceCodes = "1004";
- /*DeviceProDTO? deviceProDTO = conveyorLine.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == DeStateName && x.DeviceProParamName == "StationFree");
- if (deviceProDTO == null) return apiResponse.ErrorResponse($"WCS鏈壘鍒板簱鍙o細{DeStateName},瀵瑰簲鐨勫崗璁�");
- conveyorLine.Communicator.Read<bool>(deviceProDTO.DeviceProAddress);
- bool portStatus = conveyorLine.Communicator.Read<bool>(deviceProDTO.DeviceProAddress);
- int statusValue = portStatus ? 1 : 0;
- portStatusDict[DeStateName] = statusValue;*/
+
+ IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == DeciceCodes);
+ if (device == null) return apiResponse.ErrorResponse("WCS鏈兘鑾峰彇鍒板簱鍙e疄渚�");
+ CommonConveyorLine conveyorLine = (CommonConveyorLine)device;
+
+
+ //鏄惁鍙繘鍑�
+ DeviceProDTO? deviceProDTO = conveyorLine.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == DeStateName && x.DeviceProParamName == "PermitHandShake");
+ //鏄惁鏈夎揣
+ DeviceProDTO? StationNumProDTO = conveyorLine.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == DeStateName && x.DeviceProParamName == "StationNum");
+ if (deviceProDTO == null || StationNumProDTO ==null) return apiResponse.ErrorResponse($"WCS鏈壘鍒板簱鍙o細{DeStateName},瀵瑰簲鐨勫崗璁�");
+
+ int statusValue = 0;
+ //1鍏佽鍙� 2鍏佽鏀�
+ int portStatus = conveyorLine.Communicator.Read<ushort>(deviceProDTO.DeviceProAddress);
+ //鏄惁鏈夎揣
+ int StationStatus = conveyorLine.Communicator.Read<ushort>(StationNumProDTO.DeviceProAddress);
+
+
+ if(DeStateName=="F01" || DeStateName == "F06" || DeStateName == "F07")
+ {
+ //鏈夎揣锛屽彲杩涗俊鍙�
+ statusValue = ((portStatus == 1 && StationStatus == 1) || (portStatus == 2 && StationStatus == 0)) ? 1 : (portStatus == 0) ? 0 : 0;
+ }
+ else
+ {
+ statusValue = StationStatus == 1 ? 0 : 1;
+ }
+ portStatusDict[DeStateName] = statusValue;
}
return apiResponse.SuccessResponse(portStatusDict);
@@ -234,9 +256,64 @@
ApiResponse apiResponse = new ApiResponse();
try
{
+ string DeciceCodes = "1003";
+ if (agvUpdateRequest.warehousenumber.StartsWith("C")) DeciceCodes = "1004";
+ IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == DeciceCodes);
+ if (device == null) return apiResponse.ErrorResponse("WCS鏈兘鑾峰彇鍒板簱鍙e疄渚�");
+ CommonConveyorLine conveyorLine = (CommonConveyorLine)device;
- return apiResponse.SuccessResponse();
+ //鏄惁鍙繘鍑�
+ DeviceProDTO? HandShake = conveyorLine.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == agvUpdateRequest.warehousenumber && x.DeviceProParamName == "HandShake");
+ if (HandShake == null) return apiResponse.ErrorResponse($"WCS鏈壘鍒板簱鍙o細{agvUpdateRequest.warehousenumber},瀵瑰簲鐨勫崗璁�");
+
+ if (agvUpdateRequest.agvstatus == 1)
+ {
+ //鍐欏叆plc锛宎gv杩涘叆淇″彿
+ bool HandShakebool = conveyorLine.Communicator.Write<short>(HandShake.DeviceProAddress, 1);
+ if (HandShakebool)
+ {
+ //鏄惁鍙繘鍑� 1鍏佽鍙� 2鍏佽鏀�
+ DeviceProDTO? deviceProDTO = conveyorLine.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == agvUpdateRequest.warehousenumber && x.DeviceProParamName == "PermitHandShake");
+ //鏄惁鏈夎揣
+ DeviceProDTO? StationNumProDTO = conveyorLine.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == agvUpdateRequest.warehousenumber && x.DeviceProParamName == "StationNum");
+ if (deviceProDTO == null || StationNumProDTO == null) return apiResponse.ErrorResponse($"WCS鏈壘鍒板簱鍙o細{agvUpdateRequest.warehousenumber},瀵瑰簲鐨勫崗璁�");
+ int statusValue = 0;
+ int portStatus = conveyorLine.Communicator.Read<ushort>(deviceProDTO.DeviceProAddress);
+ int StationStatus = conveyorLine.Communicator.Read<ushort>(StationNumProDTO.DeviceProAddress);
+ //鏈夎揣锛屽彲杩涗俊鍙�
+ statusValue = ((portStatus == 1 && StationStatus == 1) || (portStatus == 2 && StationStatus == 0)) ? 1 : (portStatus == 0) ? 0 : 0;
+ if (statusValue == 1)
+ {
+ return apiResponse.SuccessResponse();
+ }
+ else
+ {
+ return apiResponse.ErrorResponse("璇诲彇plc涓嶅彲杩涘叆淇℃伅");
+ }
+ }
+ else
+ {
+ return apiResponse.ErrorResponse("鍐欏叆plc杩涘叆淇″彿澶辫触");
+ }
+ }
+ else if(agvUpdateRequest.agvstatus == 2)
+ {
+ //鍐欏叆杈撻�佺嚎淇″彿
+ bool portStatus = conveyorLine.Communicator.Write<short>(HandShake.DeviceProAddress, 0);
+ if (portStatus)
+ {
+ return apiResponse.SuccessResponse();
+ }
+ else
+ {
+ return apiResponse.ErrorResponse("鍐欏叆plc娓呴櫎淇″彿澶辫触");
+ }
+ }
+ else
+ {
+ return apiResponse.ErrorResponse($"agv瀵瑰簲鐨勭敵璇烽敊璇紝瀛楁锛歛gvstatus锛岀敵璇风殑鍊硷細{agvUpdateRequest.agvstatus}");
+ }
}
catch (Exception ex)
{
@@ -257,7 +334,7 @@
taskInfo1.taskId = taskId;
taskInfo1.taskType = taskType;
taskInfo1.invType = invType;
- taskInfo1.psd = psd;
+ taskInfo1.psd = "akjfapjfpadaoif";
commandResult = HttpHelper.Post<CommandResult>(urlWMStaskreturn, taskInfo1, "浠诲姟鐘舵�佸洖璋�");
WriteLog.Write_Log("鍚屾缁欎笂娓稿弽棣堜换鍔″畬鎴�", "浠诲姟淇℃伅", $"浠诲姟鍙凤細{taskId}", $"璋冨彇鍙傛暟锛歿taskInfo1.ToJson()},杩斿洖鍙傛暟锛歿commandResult.ToJson()}");
@@ -296,7 +373,7 @@
}
},
dealType = dealType,
- psd = psd
+ psd = "akjfapjfpadaoif",
};
commandResult = HttpHelper.Post<CommandResult>(urlWMSdeverror, deviceErrorRequest, "璁惧鏁呴殰鍥炶皟");
--
Gitblit v1.9.3