Commit 93684050 authored by 许超's avatar 许超

每日同步:2026-08-20

parent 0b4e5687
---
description: Daily git sync agent. Commits and pushes all local changes in 广联项目 to the remote. Used by scheduled Windows Task Scheduler (kb-sync.ps1).
mode: all
---
You are the daily git sync agent for 广联项目 (working directory: `D:\AI Project\广联项目2`).
Run exactly these steps, in order:
1. `git status --porcelain` — check for changes.
- If the output is empty: print exactly `NO_CHANGES` and stop (exit 0). Do nothing else.
2. `git add -A`
3. `git commit -m "每日同步:<DATE>"` where `<DATE>` is today's date in `YYYY-MM-DD` format, taken from the user's message if provided, otherwise derive from `git log -1 --format=%cd --date=short` is NOT acceptable — if no date was given in the message, ask via `powershell -NoProfile -Command "Get-Date -Format yyyy-MM-dd"` only when the commit step fails, otherwise use the date embedded in the user's instruction.
4. `git push`
- If push fails because the remote has new commits, run `git pull --rebase --autostash`, then `git push` again.
- If the rebase conflicts: run `git rebase --abort`, print `CONFLICT`, and exit with non-zero code.
5. On success, print a short summary: number of files changed, short stat (`git diff --stat HEAD~1 HEAD` style), and the new commit hash.
Rules:
- Do NOT modify, create, or delete any file content. Only git operations.
- Do NOT run any command other than git (and the date fallback above).
- If any step fails, stop immediately, print the error, and exit with a non-zero code.
$proj = "D:\AI Project\广联项目2"
$logDir = "C:\Users\lenovo\AppData\Local\Temp\opencode\kb-sync"
New-Item -ItemType Directory -Force -Path $logDir | Out-Null
$stamp = Get-Date -Format "yyyyMMdd-HHmmss"
$logFile = Join-Path $logDir "kb-sync-$stamp.log"
Set-Location $proj
$fileCount = 0
$status = & git status --porcelain
if ($LASTEXITCODE -ne 0) {
$msg = "git status 执行失败(退出码 $LASTEXITCODE)"
$ok = $false
} elseif ([string]::IsNullOrWhiteSpace($status)) {
$msg = "无变更,跳过提交"
$ok = $true
} else {
$fileCount = ($status -split "`r?`n" | Where-Object { $_ }).Count
$date = Get-Date -Format "yyyy-MM-dd"
$out = & "C:\Users\lenovo\AppData\Roaming\npm\node_modules\opencode-ai\bin\opencode.exe" run --agent kb-sync -m opencode/deepseek-v4-flash-free "执行每日 git 同步,commit message 日期为 $date" 2>&1
$code = $LASTEXITCODE
$out | Out-File $logFile -Encoding utf8
if ($code -eq 0) {
$ok = $true
$msg = "同步成功,处理 $fileCount 个变更文件"
} else {
$ok = $false
$msg = "同步失败(退出码 $code),详见日志"
}
}
$secret = "SEC1947b2889e6b496d40d263d91c0bb599b5e08a333eecec440db712795749caa7"
$token = "fd87407db6bbf80d8dc17afd793f61ea1bdbf9d53a0aa5fecb715a71a544fd72"
$timestamp = [DateTimeOffset]::UtcNow.ToUnixTimeMilliseconds().ToString()
$signStr = "$timestamp`n$secret"
$hmac = New-Object System.Security.Cryptography.HMACSHA256
$hmac.Key = [Text.Encoding]::UTF8.GetBytes($secret)
$signBytes = $hmac.ComputeHash([Text.Encoding]::UTF8.GetBytes($signStr))
$sign = [Convert]::ToBase64String($signBytes)
$url = "https://oapi.dingtalk.com/robot/send?access_token=$token&timestamp=$timestamp&sign=$([Uri]::EscapeDataString($sign))"
if ($ok) {
$title = "知识库同步成功"
$text = "## 知识库每日同步`n`n**时间**:$(Get-Date -Format 'yyyy-MM-dd HH:mm')`n**结果**:✅ $msg`n**变更文件数**:$fileCount"
} else {
$title = "知识库同步失败"
$text = "## 知识库每日同步`n`n**时间**:$(Get-Date -Format 'yyyy-MM-dd HH:mm')`n**结果**:❌ $msg`n**日志**:$logFile"
}
try {
$body = @{
msgtype = "markdown"
markdown = @{ title = $title; text = $text }
} | ConvertTo-Json -Depth 4
Invoke-RestMethod -Uri $url -Method Post -Body $body -ContentType "application/json; charset=utf-8" -ErrorAction Stop | Out-Null
} catch {
$text | Out-File $logFile -Encoding utf8 -Append
Write-Error "钉钉通知发送失败:$($_.Exception.Message)"
}
Write-Output $msg
# SAP S/4HANA Cloud 监控检查清单 —— 标准报表与操作指南
> 说明:以下为各监控领域对应的 SAP 系统标准报表与操作说明,可根据实际使用的 SAP S/4HANA Cloud 版本选择适用的工具。
---
## 一、生产与成本监控
| 监控内容 | 推荐报表/应用 | 操作路径/说明 |
|---------|-------------|-------------|
| 实际成本偏离标准成本 | **分析生产成本 - 基于事件 (F4059)** | Fiori Launchpad 搜索该应用,可设定阈值规则自动将订单标记为高/中/低风险,定期查看即可定位异常订单 |
| 生产订单入库但未投料/报工 | **监控生产订单** + **管理生产操作 (F2335)** | 先用监控应用查看订单状态汇总,发现已收货订单后,穿透到管理生产操作查看"组件消耗"和"确认"数据是否为空 |
| 报工数据与标准值偏离 | **分析生产成本 (F4059)** + **管理生产操作 (F2335)** | 先通过成本分析锁定人工成本差异大的订单,再逐单核对工序的实际工时与标准值 |
---
## 二、采购与库存监控
| 监控内容 | 推荐报表/应用 | 操作说明 |
|---------|-------------|---------|
| GR/IR 差异(收货/发票差异) | **MB5S**(GR/IR 差异报表) | 事务码 MB5S,可分析 GR/IR 差异项目,识别长期挂账或数量/价格不一致的未清项;配合 MR11 手动冲销或 F.13 自动清账处理 |
| 负库存 | **库存概览报表** / **物料凭证查询** | 通过库存管理报表筛选库存数量为负的物料,需在月结前查明原因并调整 |
---
## 三、总账与财务会计监控
| 监控内容 | 推荐报表/应用 | 操作说明 |
|---------|-------------|---------|
| 未过账凭证/期间控制 | **管理过账期间**(Fiori 应用)或事务码 **OB52** | 检查当期过账期间是否正确开放/锁定,确认所有凭证均已过账而非停留在草稿状态 |
| 往来科目核对 | 科目余额表 / 未清项报表 | 导出应收应付科目余额,逐项核对应收未清项和应付未清项,确保业务伙伴余额与总账一致 |
| 凭证一致性检查 | **比较分析(Comparative Analysis)** | 路径:财务会计 → 总账 → 定期处理 → 关账 → 核对/对账 → 比较分析。系统自动检查凭证头与行项目的一致性、借贷平衡等 |
---
## 四、资产会计与外币估值监控
| 监控内容 | 推荐报表/应用 | 操作说明 |
|---------|-------------|---------|
| 固定资产折旧运行 | **AFAB**(折旧过账) | 事务码 AFAB,确认当月计划折旧是否已成功运行并过账,检查折旧日志中是否有错误 |
| 外币估值 | **FAGL_FCV**(高级外币估值) | S/4HANA 环境下使用该应用,按期末汇率对外币余额进行重估,确认估值凭证已生成。下期初会自动冲销 |
---
## 五、成本会计完整性监控
| 监控内容 | 推荐报表/应用 | 操作说明 |
|---------|-------------|---------|
| 在制品(WIP)计算 | **CO88**(在制品计算) | 事务码 CO88,运行在制品计算,确认未完工订单的成本是否正确结转为 WIP(资产负债表存货科目) |
| 物料分类账运行 | **CKMLCP**(物料分类账结账) | 事务码 CKMLCP,运行物料分类账以还原物料实际成本,分摊采购和生产差异。结账顺序不可颠倒 |
| 成本中心费用检查 | **KSB1** / **S_ALR_87013611**(成本中心报表) | 月底检查各成本中心费用是否完整,按成本要素汇总,通过同比、环比定位异常项 |
---
## 六、全流程统筹监控工具
除了上述各领域的专项报表,SAP S/4HANA Cloud 还提供了**全流程统筹监控**的标准化工具:
| 工具名称 | 说明 |
|---------|------|
| **高级财务关账(Advanced Financial Closing)** | 基于 SAP BTP 的云端关账编排工具,可定义关账任务清单、分配责任人、设置前置依赖关系,通过 Fiori 仪表盘实时监控全流程进度 |
| **关账状态看板(Closing Cockpit)** | 显示关账周期任务的完成状态百分比,可按区域、国家分组查看任务明细,快速定位"掉队"环节 |
| **数据监控器(Data Monitor - CXCD)** + **合并监控器(Consolidation Monitor - F7271)** | 集团报表场景下,用于监控数据收集、净收入计算、货币折算、合并抵销等关账任务的执行状态 |
---
## 💡 操作建议
1. **分层使用**:日常用专项报表(如 MB5S、FAGL_FCV)检查具体数据异常;月末用高级财务关账(AFC)统筹整体进度。
2. **SAP 标准优先**:上述报表均为 SAP 标准功能,无需二次开发即可实现监控目标。
3. **建立检查清单**:将各报表检查点嵌入关账任务模板,设置前置依赖关系(如 GR/IR 清理完成后才能执行外币估值),系统会自动阻断前置任务未完成的后继操作。
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment