feat: 添加MES异步上传辅助服务并重构相关代码
refactor(WCS): 优化堆垛机任务检查逻辑和线程安全
fix(WCS): 修复调度中心服务状态判断错误
perf(WCS): 降低设备通信超时时间
refactor(WCS): 使用ConcurrentBag替换List实现线程安全存储
refactor(WMS): 重构MES上传逻辑统一使用辅助服务
docs: 补充和完善代码注释
| | |
| | | { |
| | | "tool_name": "Read", |
| | | "tool_input_preview": "{\"file_path\":\"D:\\\\Git\\\\ShanMeiXinNengYuan\\\\Code\\\\WMS\\\\WIDESEA_WMSClient_Vben_v2\\\\apps\\\\web-ele\\\\src\\\\views\\\\dashboard\\\\index.vue\"}", |
| | | "error": "File does not exist. Note: your current working directory is D:\\Git\\ShanMeiXinNengYuan\\Code.", |
| | | "timestamp": "2026-04-20T01:28:36.836Z", |
| | | "tool_name": "Bash", |
| | | "tool_input_preview": "{\"command\":\"cd \\\"D:/Git/ShanMeiXinNengYuan/Code\\\" && dotnet build WMS/WIDESEA_WMSServer/WIDESEA_WMSServer.sln 2>&1\",\"timeout\":120000,\"description\":\"Build WMS solution to verify changes\"}", |
| | | "error": "Exit code 1\n æ£å¨ç¡®å®è¦è¿åç项ç®â¦\r\n ææé¡¹ç®åæ¯ææ°çï¼æ æ³è¿åã\r\nD:\\Git\\ShanMeiXinNengYuan\\Code\\WMS\\WIDESEA_WMSServer\\WIDESEA_Core\\AOP\\LogAOP.cs(169,123): warning CS8625: æ æ³å° null åé¢é转æ¢ä¸ºé null çå¼ç¨ç±»åã [D:\\Git\\ShanMeiXinNengYuan\\Code\\WMS\\WIDESEA_WMSServer\\WIDESEA_Core\\WIDESEA_Core.csproj]\r\nD:\\Git\\ShanMeiXinNengYuan\\Code\\WMS\\WIDESEA_WMSServer\\WIDESEA_Core\\Authorization\\AuthorizationResponse.cs(21,30): warning CS8625: æ æ³å° null åé¢é转æ¢ä¸ºé null çå¼ç¨ç±»åã [D:\\Git\\ShanMeiXinNengYuan\\Code\\WMS\\WIDESEA_WMSServer\\WIDESEA_Core\\WIDES...", |
| | | "timestamp": "2026-04-20T16:56:32.862Z", |
| | | "retry_count": 1 |
| | | } |
| | |
| | | { |
| | | "updatedAt": "2026-04-20T02:13:36.765Z", |
| | | "updatedAt": "2026-04-20T17:02:18.624Z", |
| | | "missions": [ |
| | | { |
| | | "id": "session:9007b9ea-1eb6-4d24-8fe7-2c3a949eac88:none", |
| | |
| | | "sourceKey": "session-stop:a6eae12446c31bdfe" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "id": "session:bce34684-82ff-42dd-b951-6194cfe1e77c:none", |
| | | "source": "session", |
| | | "name": "none", |
| | | "objective": "Session mission", |
| | | "createdAt": "2026-04-20T15:49:37.351Z", |
| | | "updatedAt": "2026-04-20T17:02:18.624Z", |
| | | "status": "done", |
| | | "workerCount": 30, |
| | | "taskCounts": { |
| | | "total": 30, |
| | | "pending": 0, |
| | | "blocked": 0, |
| | | "inProgress": 0, |
| | | "completed": 30, |
| | | "failed": 0 |
| | | }, |
| | | "agents": [ |
| | | { |
| | | "name": "general-purpose:af087f2", |
| | | "role": "general-purpose", |
| | | "ownership": "af087f2e64d433e39", |
| | | "status": "done", |
| | | "currentStep": null, |
| | | "latestUpdate": "completed", |
| | | "completedSummary": null, |
| | | "updatedAt": "2026-04-20T17:02:18.624Z" |
| | | }, |
| | | { |
| | | "name": "general-purpose:a151e5f", |
| | | "role": "general-purpose", |
| | | "ownership": "a151e5f87f0cbdac6", |
| | | "status": "done", |
| | | "currentStep": null, |
| | | "latestUpdate": "completed", |
| | | "completedSummary": null, |
| | | "updatedAt": "2026-04-20T15:50:53.499Z" |
| | | }, |
| | | { |
| | | "name": "general-purpose:a9435dc", |
| | | "role": "general-purpose", |
| | | "ownership": "a9435dc250bc7482e", |
| | | "status": "done", |
| | | "currentStep": null, |
| | | "latestUpdate": "completed", |
| | | "completedSummary": null, |
| | | "updatedAt": "2026-04-20T15:50:38.393Z" |
| | | }, |
| | | { |
| | | "name": "general-purpose:a32b075", |
| | | "role": "general-purpose", |
| | | "ownership": "a32b0751a039672ef", |
| | | "status": "done", |
| | | "currentStep": null, |
| | | "latestUpdate": "completed", |
| | | "completedSummary": null, |
| | | "updatedAt": "2026-04-20T15:51:30.118Z" |
| | | }, |
| | | { |
| | | "name": "general-purpose:aaa2a0f", |
| | | "role": "general-purpose", |
| | | "ownership": "aaa2a0f6b2a25bec0", |
| | | "status": "done", |
| | | "currentStep": null, |
| | | "latestUpdate": "completed", |
| | | "completedSummary": null, |
| | | "updatedAt": "2026-04-20T15:51:23.092Z" |
| | | }, |
| | | { |
| | | "name": "general-purpose:a86b879", |
| | | "role": "general-purpose", |
| | | "ownership": "a86b879fb7a0801be", |
| | | "status": "done", |
| | | "currentStep": null, |
| | | "latestUpdate": "completed", |
| | | "completedSummary": null, |
| | | "updatedAt": "2026-04-20T15:52:07.543Z" |
| | | }, |
| | | { |
| | | "name": "general-purpose:a12823e", |
| | | "role": "general-purpose", |
| | | "ownership": "a12823e675f358745", |
| | | "status": "done", |
| | | "currentStep": null, |
| | | "latestUpdate": "completed", |
| | | "completedSummary": null, |
| | | "updatedAt": "2026-04-20T15:52:29.208Z" |
| | | }, |
| | | { |
| | | "name": "general-purpose:ae97a4d", |
| | | "role": "general-purpose", |
| | | "ownership": "ae97a4de553f0b4c3", |
| | | "status": "done", |
| | | "currentStep": null, |
| | | "latestUpdate": "completed", |
| | | "completedSummary": null, |
| | | "updatedAt": "2026-04-20T15:52:16.206Z" |
| | | }, |
| | | { |
| | | "name": "general-purpose:a4a2d7d", |
| | | "role": "general-purpose", |
| | | "ownership": "a4a2d7dfcc130e3c8", |
| | | "status": "done", |
| | | "currentStep": null, |
| | | "latestUpdate": "completed", |
| | | "completedSummary": null, |
| | | "updatedAt": "2026-04-20T15:53:19.832Z" |
| | | }, |
| | | { |
| | | "name": "general-purpose:afef0a2", |
| | | "role": "general-purpose", |
| | | "ownership": "afef0a2e4255227bd", |
| | | "status": "done", |
| | | "currentStep": null, |
| | | "latestUpdate": "completed", |
| | | "completedSummary": null, |
| | | "updatedAt": "2026-04-20T15:53:08.591Z" |
| | | }, |
| | | { |
| | | "name": "general-purpose:ae1e2c3", |
| | | "role": "general-purpose", |
| | | "ownership": "ae1e2c3f798ee872a", |
| | | "status": "done", |
| | | "currentStep": null, |
| | | "latestUpdate": "completed", |
| | | "completedSummary": null, |
| | | "updatedAt": "2026-04-20T15:53:36.457Z" |
| | | }, |
| | | { |
| | | "name": "general-purpose:a66e87c", |
| | | "role": "general-purpose", |
| | | "ownership": "a66e87c9223005128", |
| | | "status": "done", |
| | | "currentStep": null, |
| | | "latestUpdate": "completed", |
| | | "completedSummary": null, |
| | | "updatedAt": "2026-04-20T15:56:26.414Z" |
| | | }, |
| | | { |
| | | "name": "general-purpose:a113f70", |
| | | "role": "general-purpose", |
| | | "ownership": "a113f704503b35113", |
| | | "status": "done", |
| | | "currentStep": null, |
| | | "latestUpdate": "completed", |
| | | "completedSummary": null, |
| | | "updatedAt": "2026-04-20T15:54:23.336Z" |
| | | }, |
| | | { |
| | | "name": "general-purpose:a7cc134", |
| | | "role": "general-purpose", |
| | | "ownership": "a7cc1344397da9324", |
| | | "status": "done", |
| | | "currentStep": null, |
| | | "latestUpdate": "completed", |
| | | "completedSummary": null, |
| | | "updatedAt": "2026-04-20T15:58:27.436Z" |
| | | }, |
| | | { |
| | | "name": "general-purpose:aeac471", |
| | | "role": "general-purpose", |
| | | "ownership": "aeac471bcaec36af3", |
| | | "status": "done", |
| | | "currentStep": null, |
| | | "latestUpdate": "completed", |
| | | "completedSummary": null, |
| | | "updatedAt": "2026-04-20T16:00:25.655Z" |
| | | }, |
| | | { |
| | | "name": "general-purpose:a6c7e45", |
| | | "role": "general-purpose", |
| | | "ownership": "a6c7e458af6948696", |
| | | "status": "done", |
| | | "currentStep": null, |
| | | "latestUpdate": "completed", |
| | | "completedSummary": null, |
| | | "updatedAt": "2026-04-20T15:57:35.457Z" |
| | | }, |
| | | { |
| | | "name": "general-purpose:a5144b6", |
| | | "role": "general-purpose", |
| | | "ownership": "a5144b6e94595b89f", |
| | | "status": "done", |
| | | "currentStep": null, |
| | | "latestUpdate": "completed", |
| | | "completedSummary": null, |
| | | "updatedAt": "2026-04-20T16:01:24.405Z" |
| | | }, |
| | | { |
| | | "name": "general-purpose:ac4bbba", |
| | | "role": "general-purpose", |
| | | "ownership": "ac4bbba9b05c57c6a", |
| | | "status": "done", |
| | | "currentStep": null, |
| | | "latestUpdate": "completed", |
| | | "completedSummary": null, |
| | | "updatedAt": "2026-04-20T16:03:43.062Z" |
| | | }, |
| | | { |
| | | "name": "general-purpose:ad3b6fa", |
| | | "role": "general-purpose", |
| | | "ownership": "ad3b6fad5f339a4e5", |
| | | "status": "done", |
| | | "currentStep": null, |
| | | "latestUpdate": "completed", |
| | | "completedSummary": null, |
| | | "updatedAt": "2026-04-20T16:02:27.528Z" |
| | | }, |
| | | { |
| | | "name": "general-purpose:a72a84d", |
| | | "role": "general-purpose", |
| | | "ownership": "a72a84d56ec83e520", |
| | | "status": "done", |
| | | "currentStep": null, |
| | | "latestUpdate": "completed", |
| | | "completedSummary": null, |
| | | "updatedAt": "2026-04-20T16:03:48.315Z" |
| | | }, |
| | | { |
| | | "name": "general-purpose:a62f850", |
| | | "role": "general-purpose", |
| | | "ownership": "a62f85025e6fd117b", |
| | | "status": "done", |
| | | "currentStep": null, |
| | | "latestUpdate": "completed", |
| | | "completedSummary": null, |
| | | "updatedAt": "2026-04-20T16:04:24.590Z" |
| | | }, |
| | | { |
| | | "name": "general-purpose:a3265e6", |
| | | "role": "general-purpose", |
| | | "ownership": "a3265e63c320b7fb7", |
| | | "status": "done", |
| | | "currentStep": null, |
| | | "latestUpdate": "completed", |
| | | "completedSummary": null, |
| | | "updatedAt": "2026-04-20T16:04:17.712Z" |
| | | }, |
| | | { |
| | | "name": "general-purpose:a75fe8e", |
| | | "role": "general-purpose", |
| | | "ownership": "a75fe8e3716ab2841", |
| | | "status": "done", |
| | | "currentStep": null, |
| | | "latestUpdate": "completed", |
| | | "completedSummary": null, |
| | | "updatedAt": "2026-04-20T16:05:07.601Z" |
| | | }, |
| | | { |
| | | "name": "general-purpose:ab70218", |
| | | "role": "general-purpose", |
| | | "ownership": "ab7021856484bc64e", |
| | | "status": "done", |
| | | "currentStep": null, |
| | | "latestUpdate": "completed", |
| | | "completedSummary": null, |
| | | "updatedAt": "2026-04-20T16:18:18.639Z" |
| | | }, |
| | | { |
| | | "name": "general-purpose:a9c7d87", |
| | | "role": "general-purpose", |
| | | "ownership": "a9c7d87d13a26caa1", |
| | | "status": "done", |
| | | "currentStep": null, |
| | | "latestUpdate": "completed", |
| | | "completedSummary": null, |
| | | "updatedAt": "2026-04-20T16:18:25.585Z" |
| | | }, |
| | | { |
| | | "name": "general-purpose:ac4481c", |
| | | "role": "general-purpose", |
| | | "ownership": "ac4481cc8f2fd18cf", |
| | | "status": "done", |
| | | "currentStep": null, |
| | | "latestUpdate": "completed", |
| | | "completedSummary": null, |
| | | "updatedAt": "2026-04-20T16:18:05.225Z" |
| | | }, |
| | | { |
| | | "name": "general-purpose:ad8e51b", |
| | | "role": "general-purpose", |
| | | "ownership": "ad8e51b3e49b68c5b", |
| | | "status": "done", |
| | | "currentStep": null, |
| | | "latestUpdate": "completed", |
| | | "completedSummary": null, |
| | | "updatedAt": "2026-04-20T16:19:04.231Z" |
| | | }, |
| | | { |
| | | "name": "general-purpose:a8d6992", |
| | | "role": "general-purpose", |
| | | "ownership": "a8d69927a9c24e9b5", |
| | | "status": "done", |
| | | "currentStep": null, |
| | | "latestUpdate": "completed", |
| | | "completedSummary": null, |
| | | "updatedAt": "2026-04-20T16:36:32.273Z" |
| | | }, |
| | | { |
| | | "name": "general-purpose:a9f7c77", |
| | | "role": "general-purpose", |
| | | "ownership": "a9f7c771d702937f2", |
| | | "status": "done", |
| | | "currentStep": null, |
| | | "latestUpdate": "completed", |
| | | "completedSummary": null, |
| | | "updatedAt": "2026-04-20T16:35:27.503Z" |
| | | }, |
| | | { |
| | | "name": "general-purpose:aaecb7b", |
| | | "role": "general-purpose", |
| | | "ownership": "aaecb7b0d7ead5188", |
| | | "status": "done", |
| | | "currentStep": null, |
| | | "latestUpdate": "completed", |
| | | "completedSummary": null, |
| | | "updatedAt": "2026-04-20T16:32:32.486Z" |
| | | } |
| | | ], |
| | | "timeline": [ |
| | | { |
| | | "id": "session-start:a8d69927a9c24e9b5:2026-04-20T16:31:25.163Z", |
| | | "at": "2026-04-20T16:31:25.163Z", |
| | | "kind": "update", |
| | | "agent": "general-purpose:a8d6992", |
| | | "detail": "started general-purpose:a8d6992", |
| | | "sourceKey": "session-start:a8d69927a9c24e9b5" |
| | | }, |
| | | { |
| | | "id": "session-start:a9f7c771d702937f2:2026-04-20T16:31:25.222Z", |
| | | "at": "2026-04-20T16:31:25.222Z", |
| | | "kind": "update", |
| | | "agent": "general-purpose:a9f7c77", |
| | | "detail": "started general-purpose:a9f7c77", |
| | | "sourceKey": "session-start:a9f7c771d702937f2" |
| | | }, |
| | | { |
| | | "id": "session-start:aaecb7b0d7ead5188:2026-04-20T16:31:25.289Z", |
| | | "at": "2026-04-20T16:31:25.289Z", |
| | | "kind": "update", |
| | | "agent": "general-purpose:aaecb7b", |
| | | "detail": "started general-purpose:aaecb7b", |
| | | "sourceKey": "session-start:aaecb7b0d7ead5188" |
| | | }, |
| | | { |
| | | "id": "session-stop:aaecb7b0d7ead5188:2026-04-20T16:32:32.486Z", |
| | | "at": "2026-04-20T16:32:32.486Z", |
| | | "kind": "completion", |
| | | "agent": "general-purpose:aaecb7b", |
| | | "detail": "completed", |
| | | "sourceKey": "session-stop:aaecb7b0d7ead5188" |
| | | }, |
| | | { |
| | | "id": "session-stop:a9f7c771d702937f2:2026-04-20T16:35:27.503Z", |
| | | "at": "2026-04-20T16:35:27.503Z", |
| | | "kind": "completion", |
| | | "agent": "general-purpose:a9f7c77", |
| | | "detail": "completed", |
| | | "sourceKey": "session-stop:a9f7c771d702937f2" |
| | | }, |
| | | { |
| | | "id": "session-stop:a8d69927a9c24e9b5:2026-04-20T16:36:32.273Z", |
| | | "at": "2026-04-20T16:36:32.273Z", |
| | | "kind": "completion", |
| | | "agent": "general-purpose:a8d6992", |
| | | "detail": "completed", |
| | | "sourceKey": "session-stop:a8d69927a9c24e9b5" |
| | | }, |
| | | { |
| | | "id": "session-stop:a02e13efa2a4d4a7d:2026-04-20T16:43:22.723Z", |
| | | "at": "2026-04-20T16:43:22.723Z", |
| | | "kind": "completion", |
| | | "agent": "general-purpose:af087f2", |
| | | "detail": "completed", |
| | | "sourceKey": "session-stop:a02e13efa2a4d4a7d" |
| | | }, |
| | | { |
| | | "id": "session-stop:a82856d42f4ef095b:2026-04-20T17:02:18.624Z", |
| | | "at": "2026-04-20T17:02:18.624Z", |
| | | "kind": "completion", |
| | | "agent": "general-purpose:af087f2", |
| | | "detail": "completed", |
| | | "sourceKey": "session-stop:a82856d42f4ef095b" |
| | | } |
| | | ] |
| | | } |
| | | ] |
| | | } |
| | |
| | | "status": "completed", |
| | | "completed_at": "2026-04-20T02:08:23.744Z", |
| | | "duration_ms": 81044 |
| | | }, |
| | | { |
| | | "agent_id": "af087f2e64d433e39", |
| | | "agent_type": "general-purpose", |
| | | "started_at": "2026-04-20T15:49:37.351Z", |
| | | "parent_mode": "none", |
| | | "status": "completed", |
| | | "completed_at": "2026-04-20T15:50:06.600Z", |
| | | "duration_ms": 29249 |
| | | }, |
| | | { |
| | | "agent_id": "a151e5f87f0cbdac6", |
| | | "agent_type": "general-purpose", |
| | | "started_at": "2026-04-20T15:50:24.517Z", |
| | | "parent_mode": "none", |
| | | "status": "completed", |
| | | "completed_at": "2026-04-20T15:50:53.498Z", |
| | | "duration_ms": 28981 |
| | | }, |
| | | { |
| | | "agent_id": "a9435dc250bc7482e", |
| | | "agent_type": "general-purpose", |
| | | "started_at": "2026-04-20T15:50:24.578Z", |
| | | "parent_mode": "none", |
| | | "status": "completed", |
| | | "completed_at": "2026-04-20T15:50:38.390Z", |
| | | "duration_ms": 13812 |
| | | }, |
| | | { |
| | | "agent_id": "a32b0751a039672ef", |
| | | "agent_type": "general-purpose", |
| | | "started_at": "2026-04-20T15:51:08.683Z", |
| | | "parent_mode": "none", |
| | | "status": "completed", |
| | | "completed_at": "2026-04-20T15:51:30.117Z", |
| | | "duration_ms": 21434 |
| | | }, |
| | | { |
| | | "agent_id": "aaa2a0f6b2a25bec0", |
| | | "agent_type": "general-purpose", |
| | | "started_at": "2026-04-20T15:51:08.748Z", |
| | | "parent_mode": "none", |
| | | "status": "completed", |
| | | "completed_at": "2026-04-20T15:51:23.091Z", |
| | | "duration_ms": 14343 |
| | | }, |
| | | { |
| | | "agent_id": "a86b879fb7a0801be", |
| | | "agent_type": "general-purpose", |
| | | "started_at": "2026-04-20T15:51:49.188Z", |
| | | "parent_mode": "none", |
| | | "status": "completed", |
| | | "completed_at": "2026-04-20T15:52:07.541Z", |
| | | "duration_ms": 18353 |
| | | }, |
| | | { |
| | | "agent_id": "a12823e675f358745", |
| | | "agent_type": "general-purpose", |
| | | "started_at": "2026-04-20T15:51:49.202Z", |
| | | "parent_mode": "none", |
| | | "status": "completed", |
| | | "completed_at": "2026-04-20T15:52:29.206Z", |
| | | "duration_ms": 40004 |
| | | }, |
| | | { |
| | | "agent_id": "ae97a4de553f0b4c3", |
| | | "agent_type": "general-purpose", |
| | | "started_at": "2026-04-20T15:51:49.272Z", |
| | | "parent_mode": "none", |
| | | "status": "completed", |
| | | "completed_at": "2026-04-20T15:52:16.205Z", |
| | | "duration_ms": 26933 |
| | | }, |
| | | { |
| | | "agent_id": "a4a2d7dfcc130e3c8", |
| | | "agent_type": "general-purpose", |
| | | "started_at": "2026-04-20T15:52:54.548Z", |
| | | "parent_mode": "none", |
| | | "status": "completed", |
| | | "completed_at": "2026-04-20T15:53:19.831Z", |
| | | "duration_ms": 25283 |
| | | }, |
| | | { |
| | | "agent_id": "afef0a2e4255227bd", |
| | | "agent_type": "general-purpose", |
| | | "started_at": "2026-04-20T15:52:54.560Z", |
| | | "parent_mode": "none", |
| | | "status": "completed", |
| | | "completed_at": "2026-04-20T15:53:08.589Z", |
| | | "duration_ms": 14029 |
| | | }, |
| | | { |
| | | "agent_id": "ae1e2c3f798ee872a", |
| | | "agent_type": "general-purpose", |
| | | "started_at": "2026-04-20T15:52:54.621Z", |
| | | "parent_mode": "none", |
| | | "status": "completed", |
| | | "completed_at": "2026-04-20T15:53:36.456Z", |
| | | "duration_ms": 41835 |
| | | }, |
| | | { |
| | | "agent_id": "a66e87c9223005128", |
| | | "agent_type": "general-purpose", |
| | | "started_at": "2026-04-20T15:53:53.740Z", |
| | | "parent_mode": "none", |
| | | "status": "completed", |
| | | "completed_at": "2026-04-20T15:56:26.413Z", |
| | | "duration_ms": 152673 |
| | | }, |
| | | { |
| | | "agent_id": "a113f704503b35113", |
| | | "agent_type": "general-purpose", |
| | | "started_at": "2026-04-20T15:53:53.756Z", |
| | | "parent_mode": "none", |
| | | "status": "completed", |
| | | "completed_at": "2026-04-20T15:54:23.335Z", |
| | | "duration_ms": 29579 |
| | | }, |
| | | { |
| | | "agent_id": "a7cc1344397da9324", |
| | | "agent_type": "general-purpose", |
| | | "started_at": "2026-04-20T15:56:59.419Z", |
| | | "parent_mode": "none", |
| | | "status": "completed", |
| | | "completed_at": "2026-04-20T15:58:27.434Z", |
| | | "duration_ms": 88015 |
| | | }, |
| | | { |
| | | "agent_id": "aeac471bcaec36af3", |
| | | "agent_type": "general-purpose", |
| | | "started_at": "2026-04-20T15:56:59.484Z", |
| | | "parent_mode": "none", |
| | | "status": "completed", |
| | | "completed_at": "2026-04-20T16:00:25.654Z", |
| | | "duration_ms": 206170 |
| | | }, |
| | | { |
| | | "agent_id": "a6c7e458af6948696", |
| | | "agent_type": "general-purpose", |
| | | "started_at": "2026-04-20T15:56:59.548Z", |
| | | "parent_mode": "none", |
| | | "status": "completed", |
| | | "completed_at": "2026-04-20T15:57:35.456Z", |
| | | "duration_ms": 35908 |
| | | }, |
| | | { |
| | | "agent_id": "a5144b6e94595b89f", |
| | | "agent_type": "general-purpose", |
| | | "started_at": "2026-04-20T16:00:50.066Z", |
| | | "parent_mode": "none", |
| | | "status": "completed", |
| | | "completed_at": "2026-04-20T16:01:24.403Z", |
| | | "duration_ms": 34337 |
| | | }, |
| | | { |
| | | "agent_id": "ad3b6fad5f339a4e5", |
| | | "agent_type": "general-purpose", |
| | | "started_at": "2026-04-20T16:01:46.364Z", |
| | | "parent_mode": "none", |
| | | "status": "completed", |
| | | "completed_at": "2026-04-20T16:02:27.526Z", |
| | | "duration_ms": 41162 |
| | | }, |
| | | { |
| | | "agent_id": "ac4bbba9b05c57c6a", |
| | | "agent_type": "general-purpose", |
| | | "started_at": "2026-04-20T16:01:46.304Z", |
| | | "parent_mode": "none", |
| | | "status": "completed", |
| | | "completed_at": "2026-04-20T16:03:43.060Z", |
| | | "duration_ms": 116756 |
| | | }, |
| | | { |
| | | "agent_id": "a72a84d56ec83e520", |
| | | "agent_type": "general-purpose", |
| | | "started_at": "2026-04-20T16:01:46.423Z", |
| | | "parent_mode": "none", |
| | | "status": "completed", |
| | | "completed_at": "2026-04-20T16:03:48.313Z", |
| | | "duration_ms": 121890 |
| | | }, |
| | | { |
| | | "agent_id": "a62f85025e6fd117b", |
| | | "agent_type": "general-purpose", |
| | | "started_at": "2026-04-20T16:04:06.835Z", |
| | | "parent_mode": "none", |
| | | "status": "completed", |
| | | "completed_at": "2026-04-20T16:04:24.588Z", |
| | | "duration_ms": 17753 |
| | | }, |
| | | { |
| | | "agent_id": "a3265e63c320b7fb7", |
| | | "agent_type": "general-purpose", |
| | | "started_at": "2026-04-20T16:04:06.894Z", |
| | | "parent_mode": "none", |
| | | "status": "completed", |
| | | "completed_at": "2026-04-20T16:04:17.711Z", |
| | | "duration_ms": 10817 |
| | | }, |
| | | { |
| | | "agent_id": "a75fe8e3716ab2841", |
| | | "agent_type": "general-purpose", |
| | | "started_at": "2026-04-20T16:04:35.938Z", |
| | | "parent_mode": "none", |
| | | "status": "completed", |
| | | "completed_at": "2026-04-20T16:05:07.599Z", |
| | | "duration_ms": 31661 |
| | | }, |
| | | { |
| | | "agent_id": "ab7021856484bc64e", |
| | | "agent_type": "general-purpose", |
| | | "started_at": "2026-04-20T16:15:18.619Z", |
| | | "parent_mode": "none", |
| | | "status": "completed", |
| | | "completed_at": "2026-04-20T16:18:18.637Z", |
| | | "duration_ms": 180018 |
| | | }, |
| | | { |
| | | "agent_id": "a9c7d87d13a26caa1", |
| | | "agent_type": "general-purpose", |
| | | "started_at": "2026-04-20T16:15:18.684Z", |
| | | "parent_mode": "none", |
| | | "status": "completed", |
| | | "completed_at": "2026-04-20T16:18:25.584Z", |
| | | "duration_ms": 186900 |
| | | }, |
| | | { |
| | | "agent_id": "ac4481cc8f2fd18cf", |
| | | "agent_type": "general-purpose", |
| | | "started_at": "2026-04-20T16:15:18.748Z", |
| | | "parent_mode": "none", |
| | | "status": "completed", |
| | | "completed_at": "2026-04-20T16:18:05.224Z", |
| | | "duration_ms": 166476 |
| | | }, |
| | | { |
| | | "agent_id": "ad8e51b3e49b68c5b", |
| | | "agent_type": "general-purpose", |
| | | "started_at": "2026-04-20T16:18:33.453Z", |
| | | "parent_mode": "none", |
| | | "status": "completed", |
| | | "completed_at": "2026-04-20T16:19:04.229Z", |
| | | "duration_ms": 30776 |
| | | }, |
| | | { |
| | | "agent_id": "a8d69927a9c24e9b5", |
| | | "agent_type": "general-purpose", |
| | | "started_at": "2026-04-20T16:31:25.163Z", |
| | | "parent_mode": "none", |
| | | "status": "completed", |
| | | "completed_at": "2026-04-20T16:36:32.272Z", |
| | | "duration_ms": 307109 |
| | | }, |
| | | { |
| | | "agent_id": "a9f7c771d702937f2", |
| | | "agent_type": "general-purpose", |
| | | "started_at": "2026-04-20T16:31:25.222Z", |
| | | "parent_mode": "none", |
| | | "status": "completed", |
| | | "completed_at": "2026-04-20T16:35:27.501Z", |
| | | "duration_ms": 242279 |
| | | }, |
| | | { |
| | | "agent_id": "aaecb7b0d7ead5188", |
| | | "agent_type": "general-purpose", |
| | | "started_at": "2026-04-20T16:31:25.289Z", |
| | | "parent_mode": "none", |
| | | "status": "completed", |
| | | "completed_at": "2026-04-20T16:32:32.484Z", |
| | | "duration_ms": 67195 |
| | | } |
| | | ], |
| | | "total_spawned": 118, |
| | | "total_completed": 127, |
| | | "total_spawned": 135, |
| | | "total_completed": 157, |
| | | "total_failed": 0, |
| | | "last_updated": "2026-04-20T02:13:36.867Z" |
| | | "last_updated": "2026-04-20T17:02:18.739Z" |
| | | } |
| | |
| | | using Quartz.Spi; |
| | | using Quartz; |
| | | using System; |
| | | using System.Collections.Concurrent; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | |
| | | namespace WIDESEAWCS_QuartzJob |
| | | { |
| | | /// <summary> |
| | | /// Job注å
¥ |
| | | /// Job注å
¥å·¥åï¼ç®¡ç Job å®ä¾ç DI ä½ç¨åçå½å¨æ |
| | | /// </summary> |
| | | public class JobFactory : IJobFactory |
| | | { |
| | |
| | | private readonly IServiceProvider _serviceProvider; |
| | | |
| | | /// <summary> |
| | | /// Job å®ä¾ä¸å¯¹åºç DI ä½ç¨åæ å°ï¼ç¨äºå¨ ReturnJob æ¶æ£ç¡®éæ¾èµæº |
| | | /// </summary> |
| | | private readonly ConcurrentDictionary<IJob, IServiceScope> _scopes = new(); |
| | | |
| | | /// <summary> |
| | | /// Job注å
¥ |
| | | /// </summary> |
| | | /// <param name="serviceProvider"></param> |
| | | /// <param name="serviceProvider">æå¡æä¾è
</param> |
| | | public JobFactory(IServiceProvider serviceProvider) |
| | | { |
| | | _serviceProvider = serviceProvider; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// å®ç°æ¥å£Job |
| | | /// å建 Job å®ä¾ï¼å¹¶ä¸ºæ¯ä¸ª Job å建ç¬ç«ç DI ä½ç¨å |
| | | /// </summary> |
| | | /// <param name="bundle"></param> |
| | | /// <param name="scheduler"></param> |
| | | /// <returns></returns> |
| | | /// <param name="bundle">触åå¨è§¦åä¸ä¸æ</param> |
| | | /// <param name="scheduler">è°åº¦å¨å®ä¾</param> |
| | | /// <returns>Job å®ä¾</returns> |
| | | public IJob NewJob(TriggerFiredBundle bundle, IScheduler scheduler) |
| | | { |
| | | try |
| | | { |
| | | if (App.ExpDateTime != null && (DateTime.Now - App.ExpDateTime.GetValueOrDefault()).Seconds > 0) |
| | | // éªè¯æææï¼ä½¿ç¨ TotalSeconds é¿å
.Seconds 忍¡å¯¼è´é´ææ§å¤æé误 |
| | | if (App.ExpDateTime != null && (DateTime.Now - App.ExpDateTime.GetValueOrDefault()).TotalSeconds > 0) |
| | | { |
| | | throw new InvalidOperationException($"éªè¯é误"); |
| | | } |
| | | |
| | | // 为æ¯ä¸ª Job å建ç¬ç«ç DI ä½ç¨åï¼ç¡®ä¿ Scoped æå¡æ£ç¡®éæ¾ |
| | | IServiceScope serviceScope = _serviceProvider.CreateScope(); |
| | | IJob? job = serviceScope.ServiceProvider.GetService(bundle.JobDetail.JobType) as IJob; |
| | | |
| | | if (job == null) |
| | | { |
| | | // Job è§£æå¤±è´¥æ¶ç«å³éæ¾ä½ç¨åï¼é¿å
æ³æ¼ |
| | | serviceScope.Dispose(); |
| | | throw new InvalidOperationException($"æ æ³è§£æ Job ç±»å: {bundle.JobDetail.JobType.Name}"); |
| | | } |
| | | |
| | | // ä¿å scope å¼ç¨ï¼ä»¥ä¾¿ ReturnJob æ¶éæ¾ |
| | | _scopes[job] = serviceScope; |
| | | return job; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Console.Out.WriteLine(ex.ToString()); |
| | | throw new Exception(ex.Message); |
| | | throw; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Job注å
¥ |
| | | /// éæ¾ Job å®ä¾åå
¶å
³èç DI ä½ç¨å |
| | | /// </summary> |
| | | /// <param name="job"></param> |
| | | /// <param name="job">å¾
éæ¾ç Job å®ä¾</param> |
| | | public void ReturnJob(IJob job) |
| | | { |
| | | IDisposable? disposable = job as IDisposable; |
| | | disposable?.Dispose(); |
| | | // å
éæ¾å
³èç DI ä½ç¨åï¼å
æ¬å
¶ä¸ææ Scoped æå¡ï¼ |
| | | if (_scopes.TryRemove(job, out IServiceScope? scope)) |
| | | { |
| | | scope.Dispose(); |
| | | } |
| | | |
| | | // åéæ¾ Job æ¬èº« |
| | | (job as IDisposable)?.Dispose(); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | deviceInfos.ForEach(x => |
| | | { |
| | | if (!Storage.Devices.Exists(d => d.DeviceCode == x.DeviceCode)) |
| | | if (!Storage.Devices.Any(d => d.DeviceCode == x.DeviceCode)) |
| | | { |
| | | try |
| | | { |
| | |
| | | WebResponseContent result = new WebResponseContent(); |
| | | try |
| | | { |
| | | if (_scheduler.IsShutdown && _scheduler.IsStarted) |
| | | if (_scheduler.IsShutdown || !_scheduler.IsStarted) |
| | | { |
| | | // ä»Factoryä¸è·åSchedulerå®ä¾ |
| | | NameValueCollection collection = new NameValueCollection |
| | |
| | | } |
| | | else |
| | | { |
| | | await _scheduler.Shutdown(); |
| | | // è°åº¦å¨å·²å¨è¿è¡ï¼ç´æ¥è¿åæç¤º |
| | | result = WebResponseContent.Instance.Error(QuartzJobInfoMessage.JobHasStart); |
| | | return result; |
| | | } |
| | |
| | | //çå¾
ä»»å¡è¿è¡å®æ |
| | | await _scheduler.Shutdown(false); |
| | | |
| | | await Console.Out.WriteLineAsync(QuartzJobInfoMessage.StopJobSuccess); |
| | | QuartzLogger.Info(QuartzJobInfoMessage.StopJobSuccess); |
| | | result = WebResponseContent.Instance.OK(QuartzJobInfoMessage.StopJobSuccess); |
| | | return result; |
| | | } |
| | | else |
| | | { |
| | | IReadOnlyCollection<string> jobGroupNames = await _scheduler.GetJobGroupNames(); |
| | | |
| | | await _scheduler.PauseAll(); |
| | | |
| | | // è°åº¦å¨å·²åæ¢ï¼ç´æ¥è¿åæç¤ºï¼ä¸å对已 shutdown ç scheduler è°ç¨ PauseAllï¼ |
| | | result = WebResponseContent.Instance.Error(QuartzJobInfoMessage.JobHasStop); |
| | | return result; |
| | | } |
| | |
| | | { |
| | | try |
| | | { |
| | | if (_scheduler.IsShutdown && _scheduler.IsStarted) |
| | | if (_scheduler.IsShutdown || !_scheduler.IsStarted) |
| | | { |
| | | // ä»Factoryä¸è·åSchedulerå®ä¾ |
| | | NameValueCollection collection = new NameValueCollection |
| | |
| | | using HslCommunication; |
| | | using System.ComponentModel; |
| | | using System.Reflection; |
| | | using System.Threading; |
| | | using WIDESEAWCS_Communicator; |
| | | using WIDESEAWCS_QuartzJob.DeviceBase; |
| | | using WIDESEAWCS_QuartzJob.DTO; |
| | | using WIDESEAWCS_QuartzJob.StackerCrane; |
| | | using WIDESEAWCS_QuartzJob.StackerCrane.Common; |
| | | using WIDESEAWCS_QuartzJob.StackerCrane.Enum; |
| | | using WIDESEAWCS_Core.LogHelper; |
| | | |
| | | namespace WIDESEAWCS_QuartzJob |
| | | { |
| | |
| | | /// </summary> |
| | | private int _lastTaskNum; |
| | | |
| | | private bool _isChecked = false; |
| | | /// <summary> |
| | | /// æ è®°æ¯å¦æ£å¨æ£æ¥ä»»å¡å®æç¶æï¼volatile ä¿è¯å¤çº¿ç¨å¯è§æ§ï¼ |
| | | /// </summary> |
| | | private volatile bool _isChecked = false; |
| | | |
| | | private bool _heartStatr = true; |
| | | |
| | |
| | | { |
| | | OperateResult<TimeSpan> operateResult = new OperateResult<TimeSpan>(); |
| | | TypeCode typeCode = SiemensDBDataType.GetTypeCode(devicePro.DeviceDataType); |
| | | |
| | | // è¶
æ¶ä» 10*6000ms (60s) éä½å° 10*1000ms (10s)ï¼é²æ¢æè¿æ¶é¿æ¶é´é»å¡ |
| | | int timeout = 10 * 1000; |
| | | switch (typeCode) |
| | | { |
| | | case TypeCode.Boolean: |
| | | operateResult = Communicator.Wait(devicePro.DeviceProAddress, 500, 10 * 6000, Convert.ToBoolean(deviceProtocolDetail.ProtocalDetailValue)); |
| | | operateResult = Communicator.Wait(devicePro.DeviceProAddress, 500, timeout, Convert.ToBoolean(deviceProtocolDetail.ProtocalDetailValue)); |
| | | break; |
| | | |
| | | case TypeCode.Byte: |
| | | operateResult = Communicator.Wait(devicePro.DeviceProAddress, 500, 10 * 6000, Convert.ToByte(deviceProtocolDetail.ProtocalDetailValue)); |
| | | operateResult = Communicator.Wait(devicePro.DeviceProAddress, 500, timeout, Convert.ToByte(deviceProtocolDetail.ProtocalDetailValue)); |
| | | break; |
| | | |
| | | case TypeCode.Int16: |
| | | operateResult = Communicator.Wait(devicePro.DeviceProAddress, 500, 10 * 6000, Convert.ToInt16(deviceProtocolDetail.ProtocalDetailValue)); |
| | | operateResult = Communicator.Wait(devicePro.DeviceProAddress, 500, timeout, Convert.ToInt16(deviceProtocolDetail.ProtocalDetailValue)); |
| | | break; |
| | | |
| | | case TypeCode.Int32: |
| | | operateResult = Communicator.Wait(devicePro.DeviceProAddress, 500, 10 * 6000, Convert.ToInt32(deviceProtocolDetail.ProtocalDetailValue)); |
| | | operateResult = Communicator.Wait(devicePro.DeviceProAddress, 500, timeout, Convert.ToInt32(deviceProtocolDetail.ProtocalDetailValue)); |
| | | break; |
| | | |
| | | case TypeCode.UInt16: |
| | | operateResult = Communicator.Wait(devicePro.DeviceProAddress, 500, 10 * 6000, Convert.ToUInt16(deviceProtocolDetail.ProtocalDetailValue)); |
| | | operateResult = Communicator.Wait(devicePro.DeviceProAddress, 500, timeout, Convert.ToUInt16(deviceProtocolDetail.ProtocalDetailValue)); |
| | | break; |
| | | |
| | | case TypeCode.UInt32: |
| | | operateResult = Communicator.Wait(devicePro.DeviceProAddress, 500, 10 * 6000, Convert.ToUInt32(deviceProtocolDetail.ProtocalDetailValue)); |
| | | operateResult = Communicator.Wait(devicePro.DeviceProAddress, 500, timeout, Convert.ToUInt32(deviceProtocolDetail.ProtocalDetailValue)); |
| | | break; |
| | | |
| | | default: |
| | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | // è®°å½å¼å¸¸ï¼é¿å
é误被éé»åæ |
| | | QuartzLogger.Error($"CheckStackerCraneTaskCompleted: è®¾å¤ {_deviceCode} æ£æ¥å¼å¸¸", "CommonStackerCrane", ex); |
| | | } |
| | | finally |
| | | { |
| | |
| | | using Quartz; |
| | | using SqlSugar; |
| | | using System; |
| | | using System.Collections.Concurrent; |
| | | using System.Collections.Generic; |
| | | using System.ComponentModel; |
| | | using System.Drawing; |
| | |
| | | namespace WIDESEAWCS_QuartzJob |
| | | { |
| | | /// <summary> |
| | | /// éæåè¸åå¨åºï¼å¯ä½¿ç¨éæåéï¼ä¹å¯æ³¨å
¥ä½¿ç¨ |
| | | /// éæåéåå¨åºï¼å¯ä½¿ç¨éæåéï¼ä¹å¯æ³¨å
¥ä½¿ç¨ |
| | | /// </summary> |
| | | public class Storage |
| | | { |
| | | /// <summary> |
| | | /// å·²è¿æ¥è®¾å¤å¯¹è±¡éå |
| | | /// å·²è¿æ¥è®¾å¤å¯¹è±¡éåï¼çº¿ç¨å®å
¨ï¼ |
| | | /// </summary> |
| | | public static List<IDevice> Devices = new List<IDevice>(); |
| | | public static ConcurrentBag<IDevice> Devices = new ConcurrentBag<IDevice>(); |
| | | |
| | | /// <summary> |
| | | /// 设å¤å¯¹è±¡ |
| | |
| | | /// <summary> |
| | | /// è·åè®¾å¤ |
| | | /// </summary> |
| | | /// <param name="deviceCode"></param> |
| | | /// <returns></returns> |
| | | /// <param name="deviceCode">设å¤ç¼ç </param> |
| | | /// <returns>设å¤å®ä¾ï¼æªæ¾å°è¿å null</returns> |
| | | public IDevice? GetDevice(string deviceCode) |
| | | { |
| | | return Pro_Devices.FirstOrDefault(x => x.DeviceCode == deviceCode); |
| | |
| | | /// <summary> |
| | | /// è·åè®¾å¤ |
| | | /// </summary> |
| | | /// <param name="deviceCodes"></param> |
| | | /// <returns></returns> |
| | | /// <param name="deviceCodes">设å¤ç¼ç å表</param> |
| | | /// <returns>å¹é
ç设å¤å表</returns> |
| | | public List<IDevice> GetDevices(List<string> deviceCodes) |
| | | { |
| | | return Pro_Devices.Where(x => deviceCodes.Contains(x.DeviceCode)).ToList(); |
| | |
| | | "Logging": { |
| | | "LogLevel": { |
| | | "Default": "Information", |
| | | "Microsoft.AspNetCore": "Warning" |
| | | "Microsoft.AspNetCore": "Warning", |
| | | "Quartz": "Debug" |
| | | } |
| | | }, |
| | | "dics": "deviceType,devicePlcType,jobAssembly,jobClassName,deviceStatus,taskType,taskState,inOutType,dispatchId", |
| | |
| | | using WIDESEAWCS_Communicator; |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_Core.LogHelper; |
| | | using WIDESEAWCS_ITaskInfoService; |
| | | using WIDESEAWCS_Model.Models; |
| | | using WIDESEAWCS_QuartzJob; |
| | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | // è®°å½å¼å¸¸ï¼é¿å
é误被éé»åæ |
| | | QuartzLogger.Error("CommonConveyorLineJob Execute å¼å¸¸", "CommonConveyorLineJob", ex); |
| | | } |
| | | return Task.CompletedTask; |
| | | } |
| | |
| | | _logger = logger; |
| | | |
| | | // å è½½é
ç½®æä»¶ |
| | | _config = LoadConfig(); |
| | | //_config = LoadConfig(); |
| | | |
| | | // åå§åä»»å¡éæ©å¨ |
| | | _taskSelector = new StackerCraneTaskSelector(taskService, routerService, httpClientHelper, _logger); |
| | | |
| | | // åå§åå½ä»¤æå»ºå¨ |
| | | _commandBuilder = new StackerCraneCommandBuilder(taskService, routerService, _config, _logger); |
| | | _commandBuilder = new StackerCraneCommandBuilder(taskService, routerService, _logger); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | bool sendFlag = SendStackerCraneCommand(commonStackerCrane, stackerCraneTaskCommand); |
| | | if (sendFlag) |
| | | { |
| | | Task.Delay(1000).Wait(); |
| | | Thread.Sleep(1000); |
| | | commonStackerCrane.SetValue(StackerCraneDBName.WorkAction, (short)StackerCraneWorkActionEnum.StartTask); |
| | | // åéæåï¼æ´æ°ç¶æ |
| | | commonStackerCrane.LastTaskType = task.TaskType; |
| | |
| | | private readonly IRouterService _routerService; |
| | | |
| | | /// <summary> |
| | | /// å åæºå½ä»¤é
ç½® |
| | | /// </summary> |
| | | private readonly StackerCraneCommandConfig _config; |
| | | |
| | | /// <summary> |
| | | /// æ¥å¿è®°å½å¨ |
| | | /// </summary> |
| | | private readonly ILogger _logger; |
| | |
| | | public StackerCraneCommandBuilder( |
| | | ITaskService taskService, |
| | | IRouterService routerService, |
| | | StackerCraneCommandConfig config, |
| | | ILogger logger) |
| | | { |
| | | _taskService = taskService; |
| | | _routerService = routerService; |
| | | _config = config; |
| | | _logger = logger; |
| | | } |
| | | |
| | |
| | | /// </remarks> |
| | | /// <param name="roadway">å··éç¼ç </param> |
| | | /// <returns>å½ä»¤ç±»åï¼Standard æ Formationï¼</returns> |
| | | private string GetCommandType(string roadway) |
| | | { |
| | | foreach (var mapping in _config.RoadwayCommandMapping) |
| | | { |
| | | if (roadway.Contains(mapping.Key)) |
| | | { |
| | | QuartzLogHelper.LogDebug(_logger, "GetCommandTypeï¼å¹é
å··é {Roadway}ï¼å½ä»¤ç±»å: {CommandType}", $"GetCommandTypeï¼å¹é
å··é {roadway}ï¼å½ä»¤ç±»å: {mapping.Value}", roadway, roadway, mapping.Value); |
| | | return mapping.Value; |
| | | } |
| | | } |
| | | //private string GetCommandType(string roadway) |
| | | //{ |
| | | // foreach (var mapping in _config.RoadwayCommandMapping) |
| | | // { |
| | | // if (roadway.Contains(mapping.Key)) |
| | | // { |
| | | // QuartzLogHelper.LogDebug(_logger, "GetCommandTypeï¼å¹é
å··é {Roadway}ï¼å½ä»¤ç±»å: {CommandType}", $"GetCommandTypeï¼å¹é
å··é {roadway}ï¼å½ä»¤ç±»å: {mapping.Value}", roadway, roadway, mapping.Value); |
| | | // return mapping.Value; |
| | | // } |
| | | // } |
| | | |
| | | QuartzLogHelper.LogDebug(_logger, "GetCommandTypeï¼å··é {Roadway} æªå¹é
ï¼ä½¿ç¨é»è®¤å½ä»¤ç±»å: {DefaultType}", $"GetCommandTypeï¼å··é {roadway} æªå¹é
ï¼ä½¿ç¨é»è®¤å½ä»¤ç±»å: {_config.DefaultCommandType}", roadway, roadway, _config.DefaultCommandType); |
| | | return _config.DefaultCommandType; |
| | | } |
| | | // QuartzLogHelper.LogDebug(_logger, "GetCommandTypeï¼å··é {Roadway} æªå¹é
ï¼ä½¿ç¨é»è®¤å½ä»¤ç±»å: {DefaultType}", $"GetCommandTypeï¼å··é {roadway} æªå¹é
ï¼ä½¿ç¨é»è®¤å½ä»¤ç±»å: {_config.DefaultCommandType}", roadway, roadway, _config.DefaultCommandType); |
| | | // return _config.DefaultCommandType; |
| | | //} |
| | | |
| | | /// <summary> |
| | | /// å建æ åå½ä»¤ |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using WIDESEA_Common.StockEnum; |
| | | using WIDESEA_Core; |
| | | |
| | | namespace WIDESEA_IBasicService |
| | | { |
| | | /// <summary> |
| | | /// MES弿¥ä¸ä¼ è¾
å©æå¡ - å°è£
Task.Run + ç¶ææ´æ° + æ¥å¿è®°å½çç»ä¸æ¨¡å¼ |
| | | /// </summary> |
| | | public interface IMesUploadHelper : IDependency |
| | | { |
| | | /// <summary> |
| | | /// 以fire-and-forgetæ¹å¼å¼æ¥æ§è¡MESè°ç¨ï¼èªå¨æ´æ°ä¸ä¼ ç¶æå¹¶è®°å½æ¥å¿ |
| | | /// </summary> |
| | | /// <param name="palletCode">æçå·</param> |
| | | /// <param name="successStatus">æåæ¶çç¶ææä¸¾å¼ï¼å¥æ°=æåï¼å¶æ°=失败ï¼</param> |
| | | /// <param name="apiType">MESæ¥å£ç±»ååç§°</param> |
| | | /// <param name="requestJson">请æ±JSONï¼ç¨äºæ¥å¿è®°å½ï¼</param> |
| | | /// <param name="mesCall">MESè°ç¨å§æï¼è¿å(æ¯å¦æå, ååºJSON, éè¯¯æ¶æ¯)</param> |
| | | /// <param name="creator">æä½äºº</param> |
| | | void FireAndForget( |
| | | string palletCode, |
| | | MesUploadStatusEnum successStatus, |
| | | string apiType, |
| | | string requestJson, |
| | | Func<(bool isSuccess, string responseJson, string errorMessage)> mesCall, |
| | | string creator = "System"); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using System.Diagnostics; |
| | | using WIDESEA_Common.StockEnum; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_DTO.MES; |
| | | using WIDESEA_IStockService; |
| | | using WIDESEA_IBasicService; |
| | | |
| | | namespace WIDESEA_StockService |
| | | { |
| | | /// <summary> |
| | | /// MES弿¥ä¸ä¼ è¾
婿å¡å®ç° |
| | | /// </summary> |
| | | public class MesUploadHelper : IMesUploadHelper |
| | | { |
| | | private readonly IStockInfoService _stockInfoService; |
| | | private readonly IMesLogService _mesLogService; |
| | | |
| | | /// <summary> |
| | | /// æé 彿° |
| | | /// </summary> |
| | | /// <param name="stockInfoService">åºåä¿¡æ¯æå¡</param> |
| | | /// <param name="mesLogService">MESæ¥å¿æå¡</param> |
| | | public MesUploadHelper(IStockInfoService stockInfoService, IMesLogService mesLogService) |
| | | { |
| | | _stockInfoService = stockInfoService; |
| | | _mesLogService = mesLogService; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 以fire-and-forgetæ¹å¼å¼æ¥æ§è¡MESè°ç¨ï¼èªå¨æ´æ°ä¸ä¼ ç¶æå¹¶è®°å½æ¥å¿ |
| | | /// </summary> |
| | | public void FireAndForget( |
| | | string palletCode, |
| | | MesUploadStatusEnum successStatus, |
| | | string apiType, |
| | | string requestJson, |
| | | Func<(bool isSuccess, string responseJson, string errorMessage)> mesCall, |
| | | string creator = "System") |
| | | { |
| | | _ = Task.Run(async () => |
| | | { |
| | | var stopwatch = Stopwatch.StartNew(); |
| | | try |
| | | { |
| | | var (isSuccess, responseJson, errorMessage) = mesCall(); |
| | | stopwatch.Stop(); |
| | | |
| | | // 奿°=æåï¼å¶æ°=失败 |
| | | int status = isSuccess ? (int)successStatus : (int)successStatus + 1; |
| | | await _stockInfoService.UpdateMesUploadStatusAsync(palletCode, status); |
| | | |
| | | await LogAsync(palletCode, apiType, requestJson, responseJson, |
| | | stopwatch.ElapsedMilliseconds, isSuccess, errorMessage, creator); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | stopwatch.Stop(); |
| | | int status = (int)successStatus + 1; |
| | | await _stockInfoService.UpdateMesUploadStatusAsync(palletCode, status); |
| | | |
| | | await LogAsync(palletCode, apiType, requestJson, "", |
| | | stopwatch.ElapsedMilliseconds, false, ex.Message, creator); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// è®°å½MESæ¥å£è°ç¨æ¥å¿ |
| | | /// </summary> |
| | | private async Task LogAsync(string palletCode, string apiType, string requestJson, |
| | | string responseJson, long elapsedMs, bool isSuccess, string errorMessage, string creator) |
| | | { |
| | | try |
| | | { |
| | | await _mesLogService.LogAsync(new MesApiLogDto |
| | | { |
| | | PalletCode = palletCode, |
| | | ApiType = apiType, |
| | | RequestJson = requestJson, |
| | | ResponseJson = responseJson, |
| | | IsSuccess = isSuccess, |
| | | ErrorMessage = errorMessage, |
| | | ElapsedMs = (int)elapsedMs, |
| | | Creator = creator |
| | | }); |
| | | } |
| | | catch |
| | | { |
| | | // æ¥å¿è®°å½å¤±è´¥ä¸å½±å主æµç¨ |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | try |
| | | { |
| | | var stockInfo = await BaseDal.QueryDataFirstAsync(x => x.PalletCode == palletCode); |
| | | var stockInfo = await BaseDal.QueryFirstAsync(x => x.PalletCode == palletCode); |
| | | if (stockInfo == null) |
| | | return false; |
| | | |
| | |
| | | using Newtonsoft.Json; |
| | | using SqlSugar; |
| | | using System.Diagnostics; |
| | | using WIDESEA_Common.Constants; |
| | | using WIDESEA_Common.StockEnum; |
| | | using WIDESEA_Core; |
| | |
| | | public IMesService _mesService { get; } |
| | | |
| | | private readonly IMesLogService _mesLogService; |
| | | private readonly IMesUploadHelper _mesUploadHelper; |
| | | |
| | | /// <summary> |
| | | /// æé 彿° |
| | |
| | | /// <param name="stockInfoService">åºåä¿¡æ¯æå¡</param> |
| | | /// <param name="stockInfoDetail_HtyService">åºåæç»å岿å¡</param> |
| | | /// <param name="stockInfo_HtyService">åºåå岿å¡</param> |
| | | /// <param name="mesUploadHelper">MES弿¥ä¸ä¼ è¾
婿å¡</param> |
| | | public StockService( |
| | | IStockInfoDetailService stockInfoDetailService, |
| | | IStockInfoService stockInfoService, |
| | |
| | | IMesService mesService, |
| | | IWarehouseService warehouseService, |
| | | ISqlSugarClient sqlSugarClient, |
| | | IMesLogService mesLogService) |
| | | IMesLogService mesLogService, |
| | | IMesUploadHelper mesUploadHelper) |
| | | { |
| | | StockInfoDetailService = stockInfoDetailService; |
| | | StockInfoService = stockInfoService; |
| | |
| | | _warehouseService = warehouseService; |
| | | SqlSugarClient = sqlSugarClient; |
| | | _mesLogService = mesLogService; |
| | | _mesUploadHelper = mesUploadHelper; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | ContainCode = palletCode, |
| | | SfcList = sfcList |
| | | }; |
| | | _ = Task.Run(() => |
| | | { |
| | | var stopwatch = Stopwatch.StartNew(); |
| | | try |
| | | string requestJson = unbindRequest.ToJson(); |
| | | var localToken = token; |
| | | |
| | | _mesUploadHelper.FireAndForget( |
| | | palletCode, |
| | | MesUploadStatusEnum.æçä¸ä¼ æå, |
| | | "UnBindContainer", |
| | | requestJson, |
| | | () => |
| | | { |
| | | var unbindResult = string.IsNullOrWhiteSpace(token) |
| | | var result = string.IsNullOrWhiteSpace(localToken) |
| | | ? _mesService.UnBindContainer(unbindRequest) |
| | | : _mesService.UnBindContainer(unbindRequest, token); |
| | | stopwatch.Stop(); |
| | | |
| | | bool isSuccess = unbindResult?.Data?.IsSuccess ?? false; |
| | | int status = isSuccess |
| | | ? (int)MesUploadStatusEnum.æçä¸ä¼ æå |
| | | : (int)MesUploadStatusEnum.æçä¸ä¼ 失败; |
| | | |
| | | // æ´æ°MESä¸ä¼ ç¶æ |
| | | StockInfoService.UpdateMesUploadStatusAsync(palletCode, status).ConfigureAwait(false); |
| | | |
| | | // è®°å½MESæ¥å¿ |
| | | _mesLogService.LogAsync(new MesApiLogDto |
| | | { |
| | | PalletCode = palletCode, |
| | | ApiType = "UnBindContainer", |
| | | RequestJson = unbindRequest.ToJson(), |
| | | ResponseJson = System.Text.Json.JsonSerializer.Serialize(unbindResult), |
| | | IsSuccess = isSuccess, |
| | | ErrorMessage = unbindResult?.Data?.Msg ?? unbindResult?.ErrorMessage ?? "æªç¥é误", |
| | | ElapsedMs = (int)stopwatch.ElapsedMilliseconds, |
| | | Creator = "System" |
| | | }).ConfigureAwait(false); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | // è°ç¨å¤±è´¥ |
| | | StockInfoService.UpdateMesUploadStatusAsync(palletCode, (int)MesUploadStatusEnum.æçä¸ä¼ 失败).ConfigureAwait(false); |
| | | } |
| | | }); |
| | | : _mesService.UnBindContainer(unbindRequest, localToken); |
| | | return ( |
| | | result?.Data?.IsSuccess ?? false, |
| | | System.Text.Json.JsonSerializer.Serialize(result), |
| | | result?.Data?.Msg ?? result?.ErrorMessage ?? "æªç¥é误" |
| | | ); |
| | | }); |
| | | |
| | | // 4. å é¤ä¸´æ¶è¡¨è®°å½ |
| | | await SqlSugarClient.Deleteable<Dt_SplitTemp>().Where(t => t.PalletCode == palletCode).ExecuteCommandAsync(); |
| | |
| | | public async Task<WebResponseContent> GroupPalletConfirmAsync(string palletCode, string deviceName) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | var stopwatch = Stopwatch.StartNew(); |
| | | try |
| | | { |
| | | if (string.IsNullOrWhiteSpace(palletCode)) |
| | |
| | | }).ToList() |
| | | }; |
| | | string requestJson = bindRequest.ToJson(); |
| | | var localToken = token; |
| | | |
| | | // 3. Fire-and-forget弿¥è°ç¨MESç»å® |
| | | _ = Task.Run(() => |
| | | { |
| | | var stopwatch = Stopwatch.StartNew(); |
| | | try |
| | | _mesUploadHelper.FireAndForget( |
| | | palletCode, |
| | | MesUploadStatusEnum.ç»çä¸ä¼ æå, |
| | | "BindContainer", |
| | | requestJson, |
| | | () => |
| | | { |
| | | var bindResult = string.IsNullOrWhiteSpace(token) |
| | | var result = string.IsNullOrWhiteSpace(localToken) |
| | | ? _mesService.BindContainer(bindRequest) |
| | | : _mesService.BindContainer(bindRequest, token); |
| | | stopwatch.Stop(); |
| | | |
| | | bool isSuccess = bindResult?.Data?.IsSuccess ?? false; |
| | | int status = isSuccess |
| | | ? (int)MesUploadStatusEnum.ç»çä¸ä¼ æå |
| | | : (int)MesUploadStatusEnum.ç»çä¸ä¼ 失败; |
| | | |
| | | // æ´æ°MESä¸ä¼ ç¶æ |
| | | StockInfoService.UpdateMesUploadStatusAsync(palletCode, status).ConfigureAwait(false); |
| | | |
| | | // è®°å½MESæ¥å¿ |
| | | _mesLogService.LogAsync(new MesApiLogDto |
| | | { |
| | | PalletCode = palletCode, |
| | | ApiType = "BindContainer", |
| | | RequestJson = requestJson, |
| | | ResponseJson = System.Text.Json.JsonSerializer.Serialize(bindResult), |
| | | IsSuccess = isSuccess, |
| | | ErrorMessage = bindResult?.ErrorMessage ?? "æªç¥é误", |
| | | ElapsedMs = (int)stopwatch.ElapsedMilliseconds, |
| | | Creator = "System" |
| | | }).ConfigureAwait(false); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | // è°ç¨å¤±è´¥ |
| | | StockInfoService.UpdateMesUploadStatusAsync(palletCode, (int)MesUploadStatusEnum.ç»çä¸ä¼ 失败).ConfigureAwait(false); |
| | | } |
| | | }); |
| | | : _mesService.BindContainer(bindRequest, localToken); |
| | | return ( |
| | | result?.Data?.IsSuccess ?? false, |
| | | System.Text.Json.JsonSerializer.Serialize(result), |
| | | result?.Data?.Msg ?? result?.ErrorMessage ?? "æªç¥é误" |
| | | ); |
| | | }); |
| | | |
| | | return content.OK("æ¹éç»ç确认æå"); |
| | | } |
| | |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_DTO.GradingMachine; |
| | | using WIDESEA_DTO.MES; |
| | | using WIDESEA_DTO.Stock; |
| | | using WIDESEA_DTO.Task; |
| | | using Newtonsoft.Json; |
| | | using System.Diagnostics; |
| | | using WIDESEA_IBasicService; |
| | | using WIDESEA_IRecordService; |
| | | using WIDESEA_IStockService; |
| | |
| | | private readonly IRecordService _recordService; |
| | | private readonly IMESDeviceConfigService _mesDeviceConfigService; |
| | | private readonly IMesLogService _mesLogService; |
| | | private readonly IMesUploadHelper _mesUploadHelper; |
| | | |
| | | public IRepository<Dt_Task> Repository => BaseDal; |
| | | |
| | |
| | | IUnitOfWorkManage unitOfWorkManage, |
| | | IRecordService recordService, |
| | | IMESDeviceConfigService mesDeviceConfigService, |
| | | IMesLogService mesLogService) : base(BaseDal) |
| | | IMesLogService mesLogService, |
| | | IMesUploadHelper mesUploadHelper) : base(BaseDal) |
| | | { |
| | | _mapper = mapper; |
| | | _stockInfoService = stockInfoService; |
| | |
| | | _recordService = recordService; |
| | | _mesDeviceConfigService = mesDeviceConfigService; |
| | | _mesLogService = mesLogService; |
| | | _mesUploadHelper = mesUploadHelper; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | return DetermineTargetAddress(roadway, addressMap); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 弿¥æ§è¡MESä¸ä¼ - ä¸é»å¡ä¸»ä¸å¡é»è¾ |
| | | /// </summary> |
| | | /// <param name="palletCode">æçå·</param> |
| | | /// <param name="successStatus">æåæ¶çç¶ææä¸¾å¼ï¼å¥æ°ï¼</param> |
| | | /// <param name="uploadFunc">å
·ä½çMESè°ç¨å½æ°</param> |
| | | private async Task MesUploadAsync(string palletCode, MesUploadStatusEnum successStatus, Func<Task<HttpResponseResult<MesResponse>>> uploadFunc) |
| | | { |
| | | var stopwatch = Stopwatch.StartNew(); |
| | | string requestJson = ""; |
| | | string responseJson = ""; |
| | | bool isSuccess = false; |
| | | string errorMessage = ""; |
| | | |
| | | try |
| | | { |
| | | // è°ç¨MES |
| | | var result = await uploadFunc(); |
| | | |
| | | stopwatch.Stop(); |
| | | isSuccess = result?.Data?.IsSuccess ?? false; |
| | | errorMessage = result?.Data?.Msg ?? result?.ErrorMessage ?? "æªç¥é误"; |
| | | responseJson = JsonConvert.SerializeObject(result); |
| | | |
| | | // æ ¹æ®æå/失败å³å®ç¶æå¼ï¼å¥æ°=æåï¼å¶æ°=失败 |
| | | var uploadStatus = isSuccess ? (int)successStatus : (int)successStatus + 1; |
| | | |
| | | // æ´æ°åºåè¡¨ç¶æï¼ä¸çå¾
ï¼ |
| | | _ = _stockInfoService.UpdateMesUploadStatusAsync(palletCode, uploadStatus); |
| | | |
| | | // è®°å½MESæ¥å¿ |
| | | await LogMesCallAsync(palletCode, successStatus.ToString(), requestJson, responseJson, |
| | | stopwatch.ElapsedMilliseconds, isSuccess ? "æå" : "失败", errorMessage); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | stopwatch.Stop(); |
| | | errorMessage = ex.Message; |
| | | |
| | | // æ´æ°ç¶æä¸ºå¤±è´¥ï¼successStatus+1 å³ä¸ºå¤±è´¥ç¶æï¼ |
| | | var uploadStatus = (int)successStatus + 1; |
| | | _ = _stockInfoService.UpdateMesUploadStatusAsync(palletCode, uploadStatus); |
| | | |
| | | // è®°å½å¼å¸¸æ¥å¿ |
| | | await LogMesCallAsync(palletCode, successStatus.ToString(), requestJson, responseJson, |
| | | stopwatch.ElapsedMilliseconds, "失败", errorMessage); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// è®°å½MESæ¥å£è°ç¨æ¥å¿ |
| | | /// </summary> |
| | | private async Task LogMesCallAsync(string palletCode, string apiType, string requestJson, |
| | | string responseJson, long durationMs, string status, string errorMessage) |
| | | { |
| | | try |
| | | { |
| | | var mesLog = new MesApiLogDto |
| | | { |
| | | PalletCode = palletCode, |
| | | ApiType = apiType, |
| | | RequestJson = requestJson, |
| | | ResponseJson = responseJson, |
| | | IsSuccess = status == "æå", |
| | | ErrorMessage = errorMessage, |
| | | ElapsedMs = (int)durationMs, |
| | | Creator = "System" |
| | | }; |
| | | await _mesLogService.LogAsync(mesLog); |
| | | } |
| | | catch |
| | | { |
| | | // æ¥å¿è®°å½å¤±è´¥ä¸å½±å主æµç¨ |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | using Microsoft.AspNetCore.Http.HttpResults; |
| | | using Newtonsoft.Json; |
| | | using System.Diagnostics; |
| | | using WIDESEA_Common.Constants; |
| | | using WIDESEA_Common.LocationEnum; |
| | | using WIDESEA_Common.StockEnum; |
| | |
| | | /// </summary> |
| | | public async Task<WebResponseContent> InboundFinishTaskAsync(CreateTaskDto taskDto) |
| | | { |
| | | var stopwatch = Stopwatch.StartNew(); |
| | | try |
| | | { |
| | | var task = await BaseDal.QueryFirstAsync(s => s.PalletCode == taskDto.PalletCode); |
| | |
| | | } |
| | | else |
| | | { |
| | | |
| | | |
| | | // 夿æ¯ä¸æ¯æå·åºä»»å¡ |
| | | if (taskDto.WarehouseId == (int)WarehouseEnum.FJ1 || taskDto.WarehouseId == (int)WarehouseEnum.ZJ1) |
| | | { |
| | |
| | | string token = mesConfig?.Token; |
| | | |
| | | // 弿¥è°ç¨MESæçè¿ç«ï¼ä¸é»å¡ä¸»é»è¾ |
| | | var palletCode = taskDto.PalletCode; |
| | | var localEquipmentCode = equipmentCode; |
| | | var localResourceCode = resourceCode; |
| | | var localToken = token; |
| | | _ = Task.Run(async () => |
| | | var inboundRequest = new InboundInContainerRequest |
| | | { |
| | | var localStopwatch = Stopwatch.StartNew(); |
| | | try |
| | | EquipmentCode = equipmentCode, |
| | | ResourceCode = resourceCode, |
| | | LocalTime = DateTime.Now, |
| | | ContainerCode = taskDto.PalletCode |
| | | }; |
| | | string requestJson = inboundRequest.ToJson(); |
| | | var palletCode = taskDto.PalletCode; |
| | | |
| | | _mesUploadHelper.FireAndForget( |
| | | palletCode, |
| | | MesUploadStatusEnum.è¿ç«ä¸ä¼ æå, |
| | | "InboundInContainer", |
| | | requestJson, |
| | | () => |
| | | { |
| | | var inboundRequest = new InboundInContainerRequest |
| | | { |
| | | EquipmentCode = localEquipmentCode, |
| | | ResourceCode = localResourceCode, |
| | | LocalTime = DateTime.Now, |
| | | ContainerCode = palletCode |
| | | }; |
| | | string localRequestJson = inboundRequest.ToJson(); |
| | | var inboundResult = string.IsNullOrWhiteSpace(localToken) |
| | | var result = string.IsNullOrWhiteSpace(token) |
| | | ? _mesService.InboundInContainer(inboundRequest) |
| | | : _mesService.InboundInContainer(inboundRequest, localToken); |
| | | localStopwatch.Stop(); |
| | | : _mesService.InboundInContainer(inboundRequest, token); |
| | | return ( |
| | | result?.Data?.IsSuccess ?? false, |
| | | JsonConvert.SerializeObject(result), |
| | | result?.Data?.Msg ?? result?.ErrorMessage ?? "æªç¥é误" |
| | | ); |
| | | }); |
| | | |
| | | bool isSuccess = inboundResult?.Data?.IsSuccess ?? false; |
| | | int status = isSuccess |
| | | ? (int)MesUploadStatusEnum.è¿ç«ä¸ä¼ æå |
| | | : (int)MesUploadStatusEnum.è¿ç«ä¸ä¼ 失败; |
| | | |
| | | await _stockInfoService.UpdateMesUploadStatusAsync(palletCode, status); |
| | | |
| | | await _mesLogService.LogAsync(new MesApiLogDto |
| | | { |
| | | PalletCode = palletCode, |
| | | ApiType = "InboundInContainer", |
| | | RequestJson = localRequestJson, |
| | | ResponseJson = JsonConvert.SerializeObject(inboundResult), |
| | | IsSuccess = isSuccess, |
| | | ErrorMessage = inboundResult?.Data?.Msg ?? inboundResult?.ErrorMessage ?? "æªç¥é误", |
| | | ElapsedMs = (int)localStopwatch.ElapsedMilliseconds, |
| | | Creator = "systeam" |
| | | }); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | localStopwatch.Stop(); |
| | | await _stockInfoService.UpdateMesUploadStatusAsync(palletCode, (int)MesUploadStatusEnum.è¿ç«ä¸ä¼ 失败); |
| | | await _mesLogService.LogAsync(new MesApiLogDto |
| | | { |
| | | PalletCode = palletCode, |
| | | ApiType = "InboundInContainer", |
| | | IsSuccess = false, |
| | | ErrorMessage = ex.Message, |
| | | ElapsedMs = (int)localStopwatch.ElapsedMilliseconds, |
| | | Creator = "systeam" |
| | | }); |
| | | } |
| | | }); |
| | | return await CompleteTaskAsync(task, "å
¥åºå®æ"); |
| | | }); |
| | | } |
| | |
| | | using System.Diagnostics; |
| | | using WIDESEA_Common.Constants; |
| | | using WIDESEA_Common.LocationEnum; |
| | | using WIDESEA_Common.StockEnum; |
| | |
| | | /// </summary> |
| | | public async Task<WebResponseContent> OutboundFinishTaskAsync(CreateTaskDto taskDto) |
| | | { |
| | | var stopwatch = Stopwatch.StartNew(); |
| | | try |
| | | { |
| | | var task = await BaseDal.QueryFirstAsync(s => s.PalletCode == taskDto.PalletCode); |
| | |
| | | ContainerCode = taskDto.PalletCode |
| | | }; |
| | | string palletCode = taskDto.PalletCode; |
| | | string requestJson = outboundRequest.ToJson(); |
| | | |
| | | // Fire-and-forget: 弿¥æ§è¡MESåºç«ï¼ä¸é»å¡ä¸»ä¸å¡é»è¾ |
| | | _ = Task.Run(() => MesUploadAsync(palletCode, MesUploadStatusEnum.åºç«ä¸ä¼ æå, async () => |
| | | { |
| | | return await Task.FromResult(string.IsNullOrWhiteSpace(token) |
| | | ? _mesService.OutboundInContainer(outboundRequest) |
| | | : _mesService.OutboundInContainer(outboundRequest, token)); |
| | | })); |
| | | _mesUploadHelper.FireAndForget( |
| | | palletCode, |
| | | MesUploadStatusEnum.åºç«ä¸ä¼ æå, |
| | | "OutboundInContainer", |
| | | requestJson, |
| | | () => |
| | | { |
| | | var result = string.IsNullOrWhiteSpace(token) |
| | | ? _mesService.OutboundInContainer(outboundRequest) |
| | | : _mesService.OutboundInContainer(outboundRequest, token); |
| | | return ( |
| | | result?.Data?.IsSuccess ?? false, |
| | | Newtonsoft.Json.JsonConvert.SerializeObject(result), |
| | | result?.Data?.Msg ?? result?.ErrorMessage ?? "æªç¥é误" |
| | | ); |
| | | }); |
| | | |
| | | var completeResult = await CompleteTaskAsync(task, "åºåºå®æ"); |
| | | if (!completeResult.Status) |
| | |
| | | using WIDESEA_Model.Models; |
| | | using WIDESEA_Common.Constants; |
| | | using WIDESEA_Common.StockEnum; |
| | | using System.Diagnostics; |
| | | |
| | | namespace WIDESEA_WMSServer.Controllers.Stock |
| | | { |
| | |
| | | [ApiController] |
| | | public class StockInfoController : ApiBaseController<IStockInfoService, Dt_StockInfo> |
| | | { |
| | | private readonly IMesLogService _mesLogService; |
| | | private readonly IMesService _mesService; |
| | | private readonly IMESDeviceConfigService _mesDeviceConfigService; |
| | | private readonly ISys_DictionaryService _sysDictionaryService; |
| | | private readonly IStockInfoService _stockInfoService; |
| | | private readonly IMesUploadHelper _mesUploadHelper; |
| | | |
| | | public StockInfoController( |
| | | IStockInfoService service, |
| | | IMesLogService mesLogService, |
| | | IMesService mesService, |
| | | IMESDeviceConfigService mesDeviceConfigService, |
| | | ISys_DictionaryService sysDictionaryService, |
| | | IStockInfoService stockInfoService) : base(service) |
| | | IMesUploadHelper mesUploadHelper) : base(service) |
| | | { |
| | | _mesLogService = mesLogService; |
| | | _mesService = mesService; |
| | | _mesDeviceConfigService = mesDeviceConfigService; |
| | | _sysDictionaryService = sysDictionaryService; |
| | | _stockInfoService = stockInfoService; |
| | | _mesUploadHelper = mesUploadHelper; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | string palletCode = stockInfo.PalletCode; |
| | | |
| | | // 5. 弿¥æ§è¡MESè°ç¨ï¼fire-and-forgetï¼ |
| | | _ = Task.Run(async () => |
| | | { |
| | | var localStopwatch = Stopwatch.StartNew(); |
| | | try |
| | | _mesUploadHelper.FireAndForget( |
| | | palletCode, |
| | | MesUploadStatusEnum.è¿ç«ä¸ä¼ æå, |
| | | "InboundInContainer", |
| | | requestJson, |
| | | () => |
| | | { |
| | | var result = string.IsNullOrWhiteSpace(token) |
| | | ? _mesService.InboundInContainer(mesRequest) |
| | | : _mesService.InboundInContainer(mesRequest, token); |
| | | localStopwatch.Stop(); |
| | | |
| | | bool isSuccess = result?.IsSuccess ?? false; |
| | | int status = isSuccess |
| | | ? (int)MesUploadStatusEnum.è¿ç«ä¸ä¼ æå |
| | | : (int)MesUploadStatusEnum.è¿ç«ä¸ä¼ 失败; |
| | | |
| | | await _stockInfoService.UpdateMesUploadStatusAsync(palletCode, status); |
| | | |
| | | await _mesLogService.LogAsync(new MesApiLogDto |
| | | { |
| | | PalletCode = palletCode, |
| | | ApiType = "InboundInContainer", |
| | | RequestJson = requestJson, |
| | | ResponseJson = System.Text.Json.JsonSerializer.Serialize(result), |
| | | IsSuccess = isSuccess, |
| | | ErrorMessage = result?.ErrorMessage ?? "æªç¥é误", |
| | | ElapsedMs = (int)localStopwatch.ElapsedMilliseconds, |
| | | Creator = App.User.UserName |
| | | }); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | localStopwatch.Stop(); |
| | | await _stockInfoService.UpdateMesUploadStatusAsync(palletCode, (int)MesUploadStatusEnum.è¿ç«ä¸ä¼ 失败); |
| | | await _mesLogService.LogAsync(new MesApiLogDto |
| | | { |
| | | PalletCode = palletCode, |
| | | ApiType = "InboundInContainer", |
| | | IsSuccess = false, |
| | | ErrorMessage = ex.Message, |
| | | ElapsedMs = (int)localStopwatch.ElapsedMilliseconds, |
| | | Creator = App.User.UserName |
| | | }); |
| | | } |
| | | }); |
| | | return ( |
| | | result?.IsSuccess ?? false, |
| | | System.Text.Json.JsonSerializer.Serialize(result), |
| | | result?.ErrorMessage ?? "æªç¥é误" |
| | | ); |
| | | }, |
| | | App.User.UserName); |
| | | |
| | | // 6. ç«å³è¿åæå |
| | | return response.OK("æçè¿ç«æå"); |
| | |
| | | string palletCode = stockInfo.PalletCode; |
| | | |
| | | // 5. 弿¥æ§è¡MESè°ç¨ï¼fire-and-forgetï¼ |
| | | _ = Task.Run(async () => |
| | | { |
| | | var localStopwatch = Stopwatch.StartNew(); |
| | | try |
| | | _mesUploadHelper.FireAndForget( |
| | | palletCode, |
| | | MesUploadStatusEnum.åºç«ä¸ä¼ æå, |
| | | "OutboundInContainer", |
| | | requestJson, |
| | | () => |
| | | { |
| | | var result = string.IsNullOrWhiteSpace(token) |
| | | ? _mesService.OutboundInContainer(mesRequest) |
| | | : _mesService.OutboundInContainer(mesRequest, token); |
| | | localStopwatch.Stop(); |
| | | |
| | | bool isSuccess = result?.IsSuccess ?? false; |
| | | int status = isSuccess |
| | | ? (int)MesUploadStatusEnum.åºç«ä¸ä¼ æå |
| | | : (int)MesUploadStatusEnum.åºç«ä¸ä¼ 失败; |
| | | |
| | | await _stockInfoService.UpdateMesUploadStatusAsync(palletCode, status); |
| | | |
| | | await _mesLogService.LogAsync(new MesApiLogDto |
| | | { |
| | | PalletCode = palletCode, |
| | | ApiType = "OutboundInContainer", |
| | | RequestJson = requestJson, |
| | | ResponseJson = System.Text.Json.JsonSerializer.Serialize(result), |
| | | IsSuccess = isSuccess, |
| | | ErrorMessage = result?.ErrorMessage ?? "æªç¥é误", |
| | | ElapsedMs = (int)localStopwatch.ElapsedMilliseconds, |
| | | Creator = App.User.UserName |
| | | }); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | localStopwatch.Stop(); |
| | | await _stockInfoService.UpdateMesUploadStatusAsync(palletCode, (int)MesUploadStatusEnum.åºç«ä¸ä¼ 失败); |
| | | await _mesLogService.LogAsync(new MesApiLogDto |
| | | { |
| | | PalletCode = palletCode, |
| | | ApiType = "OutboundInContainer", |
| | | IsSuccess = false, |
| | | ErrorMessage = ex.Message, |
| | | ElapsedMs = (int)localStopwatch.ElapsedMilliseconds, |
| | | Creator = App.User.UserName |
| | | }); |
| | | } |
| | | }); |
| | | return ( |
| | | result?.IsSuccess ?? false, |
| | | System.Text.Json.JsonSerializer.Serialize(result), |
| | | result?.ErrorMessage ?? "æªç¥é误" |
| | | ); |
| | | }, |
| | | App.User.UserName); |
| | | |
| | | // 6. ç«å³è¿åæå |
| | | return response.OK("æçåºç«æå"); |
| | |
| | | using WIDESEA_Model.Models; |
| | | using WIDESEA_Common.Constants; |
| | | using WIDESEA_Common.StockEnum; |
| | | using System.Diagnostics; |
| | | |
| | | namespace WIDESEA_WMSServer.Controllers.Stock |
| | | { |
| | |
| | | [ApiController] |
| | | public class StockInfoDetailController : ApiBaseController<IStockInfoDetailService, Dt_StockInfoDetail> |
| | | { |
| | | private readonly IMesLogService _mesLogService; |
| | | private readonly IMesService _mesService; |
| | | private readonly ISys_DictionaryService _sysDictionaryService; |
| | | private readonly IStockInfoService _stockInfoService; |
| | | private readonly IMESDeviceConfigService _mesDeviceConfigService; |
| | | private readonly IMesUploadHelper _mesUploadHelper; |
| | | |
| | | public StockInfoDetailController( |
| | | IStockInfoDetailService service, |
| | | IMesLogService mesLogService, |
| | | IMesService mesService, |
| | | ISys_DictionaryService sysDictionaryService, |
| | | IStockInfoService stockInfoService, |
| | | IMESDeviceConfigService mesDeviceConfigService) : base(service) |
| | | IMESDeviceConfigService mesDeviceConfigService, |
| | | IMesUploadHelper mesUploadHelper) : base(service) |
| | | { |
| | | _mesLogService = mesLogService; |
| | | _mesService = mesService; |
| | | _sysDictionaryService = sysDictionaryService; |
| | | _stockInfoService = stockInfoService; |
| | | _mesDeviceConfigService = mesDeviceConfigService; |
| | | _mesUploadHelper = mesUploadHelper; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | string requestJson = System.Text.Json.JsonSerializer.Serialize(mesRequest); |
| | | |
| | | // 5. 弿¥è°ç¨MESæ¥å£ï¼fire-and-forgetï¼ |
| | | var localToken = token; |
| | | _ = Task.Run(async () => |
| | | { |
| | | var localStopwatch = Stopwatch.StartNew(); |
| | | try |
| | | _mesUploadHelper.FireAndForget( |
| | | stockInfo.PalletCode, |
| | | MesUploadStatusEnum.ç»çä¸ä¼ æå, |
| | | "BindContainer", |
| | | requestJson, |
| | | () => |
| | | { |
| | | var result = string.IsNullOrWhiteSpace(localToken) |
| | | var result = string.IsNullOrWhiteSpace(token) |
| | | ? _mesService.BindContainer(mesRequest) |
| | | : _mesService.BindContainer(mesRequest, localToken); |
| | | localStopwatch.Stop(); |
| | | |
| | | bool isSuccess = result?.IsSuccess ?? false; |
| | | int status = isSuccess |
| | | ? (int)MesUploadStatusEnum.ç»çä¸ä¼ æå |
| | | : (int)MesUploadStatusEnum.ç»çä¸ä¼ 失败; |
| | | |
| | | await _stockInfoService.UpdateMesUploadStatusAsync(stockInfo.PalletCode, status); |
| | | |
| | | await _mesLogService.LogAsync(new MesApiLogDto |
| | | { |
| | | PalletCode = stockInfo.PalletCode, |
| | | ApiType = "BindContainer", |
| | | RequestJson = requestJson, |
| | | ResponseJson = System.Text.Json.JsonSerializer.Serialize(result), |
| | | IsSuccess = isSuccess, |
| | | ErrorMessage = result?.ErrorMessage ?? "æªç¥é误", |
| | | ElapsedMs = (int)localStopwatch.ElapsedMilliseconds, |
| | | Creator = App.User.UserName |
| | | }); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | localStopwatch.Stop(); |
| | | await _stockInfoService.UpdateMesUploadStatusAsync(stockInfo.PalletCode, (int)MesUploadStatusEnum.ç»çä¸ä¼ 失败); |
| | | await _mesLogService.LogAsync(new MesApiLogDto |
| | | { |
| | | PalletCode = stockInfo.PalletCode, |
| | | ApiType = "BindContainer", |
| | | IsSuccess = false, |
| | | ErrorMessage = ex.Message, |
| | | ElapsedMs = (int)localStopwatch.ElapsedMilliseconds, |
| | | Creator = App.User.UserName |
| | | }); |
| | | } |
| | | }); |
| | | : _mesService.BindContainer(mesRequest, token); |
| | | return ( |
| | | result?.IsSuccess ?? false, |
| | | System.Text.Json.JsonSerializer.Serialize(result), |
| | | result?.ErrorMessage ?? "æªç¥é误" |
| | | ); |
| | | }, |
| | | App.User.UserName); |
| | | |
| | | // 6. ç«å³è¿åæåååº |
| | | return response.OK("æççµè¯ç»å®æå"); |
| | |
| | | string requestJson = System.Text.Json.JsonSerializer.Serialize(mesRequest); |
| | | |
| | | // 5. 弿¥è°ç¨MESæ¥å£ï¼fire-and-forgetï¼ |
| | | var localToken = token; |
| | | _ = Task.Run(async () => |
| | | { |
| | | var localStopwatch = Stopwatch.StartNew(); |
| | | try |
| | | _mesUploadHelper.FireAndForget( |
| | | stockInfo.PalletCode, |
| | | MesUploadStatusEnum.æçä¸ä¼ æå, |
| | | "UnbindContainer", |
| | | requestJson, |
| | | () => |
| | | { |
| | | var result = string.IsNullOrWhiteSpace(localToken) |
| | | var result = string.IsNullOrWhiteSpace(token) |
| | | ? _mesService.UnBindContainer(mesRequest) |
| | | : _mesService.UnBindContainer(mesRequest, localToken); |
| | | localStopwatch.Stop(); |
| | | |
| | | bool isSuccess = result?.IsSuccess ?? false; |
| | | int status = isSuccess |
| | | ? (int)MesUploadStatusEnum.æçä¸ä¼ æå |
| | | : (int)MesUploadStatusEnum.æçä¸ä¼ 失败; |
| | | |
| | | await _stockInfoService.UpdateMesUploadStatusAsync(stockInfo.PalletCode, status); |
| | | |
| | | await _mesLogService.LogAsync(new MesApiLogDto |
| | | { |
| | | PalletCode = stockInfo.PalletCode, |
| | | ApiType = "UnbindContainer", |
| | | RequestJson = requestJson, |
| | | ResponseJson = System.Text.Json.JsonSerializer.Serialize(result), |
| | | IsSuccess = isSuccess, |
| | | ErrorMessage = result?.ErrorMessage ?? "æªç¥é误", |
| | | ElapsedMs = (int)localStopwatch.ElapsedMilliseconds, |
| | | Creator = App.User.UserName |
| | | }); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | localStopwatch.Stop(); |
| | | await _stockInfoService.UpdateMesUploadStatusAsync(stockInfo.PalletCode, (int)MesUploadStatusEnum.æçä¸ä¼ 失败); |
| | | await _mesLogService.LogAsync(new MesApiLogDto |
| | | { |
| | | PalletCode = stockInfo.PalletCode, |
| | | ApiType = "UnbindContainer", |
| | | IsSuccess = false, |
| | | ErrorMessage = ex.Message, |
| | | ElapsedMs = (int)localStopwatch.ElapsedMilliseconds, |
| | | Creator = App.User.UserName |
| | | }); |
| | | } |
| | | }); |
| | | : _mesService.UnBindContainer(mesRequest, token); |
| | | return ( |
| | | result?.IsSuccess ?? false, |
| | | System.Text.Json.JsonSerializer.Serialize(result), |
| | | result?.ErrorMessage ?? "æªç¥é误" |
| | | ); |
| | | }, |
| | | App.User.UserName); |
| | | |
| | | // 6. ç«å³è¿åæåååº |
| | | return response.OK("æççµè¯è§£ç»æå"); |
| | |
| | | string requestJson = System.Text.Json.JsonSerializer.Serialize(mesRequest); |
| | | |
| | | // 5. 弿¥è°ç¨MESæ¥å£ï¼fire-and-forgetï¼ |
| | | _ = Task.Run(async () => |
| | | { |
| | | var localStopwatch = Stopwatch.StartNew(); |
| | | try |
| | | _mesUploadHelper.FireAndForget( |
| | | stockInfo.PalletCode, |
| | | MesUploadStatusEnum.NG䏿¥æå, |
| | | "ContainerNgReport", |
| | | requestJson, |
| | | () => |
| | | { |
| | | var result = _mesService.ContainerNgReport(mesRequest); |
| | | localStopwatch.Stop(); |
| | | |
| | | bool isSuccess = result?.IsSuccess ?? false; |
| | | int status = isSuccess |
| | | ? (int)MesUploadStatusEnum.NG䏿¥æå |
| | | : (int)MesUploadStatusEnum.NG䏿¥å¤±è´¥; |
| | | |
| | | await _stockInfoService.UpdateMesUploadStatusAsync(stockInfo.PalletCode, status); |
| | | |
| | | await _mesLogService.LogAsync(new MesApiLogDto |
| | | { |
| | | PalletCode = stockInfo.PalletCode, |
| | | ApiType = "ContainerNgReport", |
| | | RequestJson = requestJson, |
| | | ResponseJson = System.Text.Json.JsonSerializer.Serialize(result), |
| | | IsSuccess = isSuccess, |
| | | ErrorMessage = result?.ErrorMessage ?? "æªç¥é误", |
| | | ElapsedMs = (int)localStopwatch.ElapsedMilliseconds, |
| | | Creator = App.User.UserName |
| | | }); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | localStopwatch.Stop(); |
| | | await _stockInfoService.UpdateMesUploadStatusAsync(stockInfo.PalletCode, (int)MesUploadStatusEnum.NG䏿¥å¤±è´¥); |
| | | await _mesLogService.LogAsync(new MesApiLogDto |
| | | { |
| | | PalletCode = stockInfo.PalletCode, |
| | | ApiType = "ContainerNgReport", |
| | | IsSuccess = false, |
| | | ErrorMessage = ex.Message, |
| | | ElapsedMs = (int)localStopwatch.ElapsedMilliseconds, |
| | | Creator = App.User.UserName |
| | | }); |
| | | } |
| | | }); |
| | | return ( |
| | | result?.IsSuccess ?? false, |
| | | System.Text.Json.JsonSerializer.Serialize(result), |
| | | result?.ErrorMessage ?? "æªç¥é误" |
| | | ); |
| | | }, |
| | | App.User.UserName); |
| | | |
| | | // 6. ç«å³è¿åæåååº |
| | | return response.OK("NGçµè¯ä¸æ¥æå"); |