Back to skills
extension
Category: OtherNo API key required

yangzhi-dangan

养殖档案排查(试)技能统一入口。强制按基线确认、原始证据读取、日报解析、逐表逐单元格核对、跨表勾稽、完整FIFO/覆盖回放、最终复核的闭环流程,综合核对畜禽养殖档案工作簿及生产日报/F22/F23、ERP入出库记录、独立标准表、标签/截图、问题.docx和核对输出。Use when the user asks to核对/复核/排查/补漏/整理/检查养殖档案问题,直接输出可整改中文问题表述,或跨表检查兽药购进/使用、饲料购进/使用、诊疗、免疫、消毒、生产记录、病死无害化、防疫质量监测、ERP调拨入库、ERP领料出库、批号/生产日期FIFO、处方笺、生产日报数量、兽药购进标签、兽药剂量/配伍禁忌、日报导出辅助、每次检查养殖档案都自动做完整 FIFO/原始购进批号闭合确认、日报存栏/日龄/用量一致性、漏填写/错填写/数量差异。

personAuthor: user_48161325hubcommunity

养殖档案排查(试)

技能入口:yangzhi-dangan。展示名称:养殖档案排查(试)。原中文别名:养殖档案(总汇总)养殖档案排查。用户提到任一名称时,都按本技能执行。

Overview

Use this skill as the single entry point for养殖档案 work. It consolidates the former yangzhi-dangan-* skills, supporting installed niche skills, and rules proven in D:\12064\Documents\问题流程整理 and D:\codex101. When a task is about养殖档案, route through this skill first; treat narrower skills as internal sub-procedures or resource libraries, not separate final workflows.

Prefer concise, high-confidence Chinese整改问题句. Preserve source evidence and row paths in report files, but do not bury the user in process unless they ask.

Source Scope

Treat these as source material for this skill:

  • Current user-provided archive workbook, production daily report, ERP export, screenshots, label photos, and 问题.docx.
  • Built-in veterinary drug standard workbook: references/兽药使用标准.xlsx. Load this file by default for 兽药购进记录, 兽药使用记录 withdrawal-period checks, approval-number identity checks, and purchase-location/agent checks, even when the user does not explicitly provide a standard file.
  • Legacy skill bodies integrated here: yangzhi-dangan-paicha-zong, yangzhi-dangan-erp-dangan-ribao, yangzhi-dangan-hedui-4-24.
  • Downloaded legacy skill snapshots such as D:\下载\yangzhi-dangan-hedui-4-24.md can be mined for missing durable rules, but merge them additively and never let an older rule override the current independent-standard, ERP, FIFO, or final-output gates.
  • Practical scripts and learnings in D:\12064\Documents\问题流程整理 and D:\codex101.
  • Supporting skills integrated as sub-procedures: batch-hedao, chufangjian-paicha, production-report-quantity, farm-ledger-reconcile, vet-drug-check, vet-drug-goujin, vet-drug-purchase-label-check, and daily-report-export-single-values.

Do not rely on old JSON/CSV outputs as final evidence. They are clues only; re-open the current original workbook, ERP sheet, daily report, label image, or confirmed user evidence before reporting a new issue. If the user provides a newer or explicit 兽药使用标准 file, prefer that file over the bundled copy and record its path. Otherwise, the bundled references/兽药使用标准.xlsx is mandatory source evidence. For same-farm/same-batch reruns, first search existing project scripts and prior outputs for a farm-specific checker. Reuse that checker by overriding only the current source paths and standards; do not rebuild parser logic from scratch when the old script already matches the file structure.

Integrated Sub-Procedures

Use these former standalone skills only through this unified workflow when the current user task is an养殖档案 audit:

  • batch-hedao: batch/FIFO rules for 兽药购进记录, 兽药使用记录, 饲料和饲料添加剂购进记录, and 配合饲料使用记录; apply the stricter full-history FIFO rules in this skill before final output.
  • chufangjian-paicha: prescription slip checks against 畜禽疾病诊疗记录, next-day 兽药使用记录, and 兽药使用标准; final issues still follow this skill's整改句 and evidence gates.
  • production-report-quantity: same-day same-house production-report stock checks for diagnosis, immunization, treatment, dead-disposal, and similar quantity fields.
  • farm-ledger-reconcile: ERP .xls versus archive .xlsx quantity reconciliation; use its scripts for pivot/supplement evidence, then classify findings through this skill's final/pending/filter buckets.
  • vet-drug-check: veterinary-drug daily-report dosage, continuous-use, and same-house same-day contraindication checks; use only when dosage/compliance is in scope or daily-report drug compliance is requested.
  • vet-drug-goujin: veterinary purchase field checks. In this unified skill, keep its field logic but prefer the independent 兽药使用标准.xlsx over the archive 辅助用表 unless the independent standard lacks the approval number or the user explicitly approves fallback.
  • vet-drug-purchase-label-check: label/photo/zip checks for purchase rows; visible label fields override helper formulas and old outputs.
  • daily-report-export-single-values: helper for extracting 日报 values-only files before parsing; it does not replace source-evidence review.

Do not duplicate these skills' final answers directly. Extract their deterministic scripts, parsing rules, or field rules as candidate evidence, then pass every finding through the mandatory gates, ERP/FIFO checks, dedupe, and final Chinese整改句 output here.

Mandatory Execution Gate

Treat this as a hard checklist. Do not skip a gate because one script ran successfully; script output is only a candidate until the gate is closed against current original evidence.

  1. Scope gate: identify this round's exact archive workbook, production daily report files, ERP files, standards/labels/screenshots, farm, batch, date range, and user-requested target scope. If any required source is missing, record the gap before judging the related rule.
  2. Baseline gate: read existing 问题.docx, prior核对输出, user-confirmed issues, and user-confirmed "not a problem"口径. New output must not duplicate or revive excluded findings.
  3. Source gate: load current original workbooks with openpyxl, pandas, existing scripts, or equivalent parsers. Record actual file paths and key sheet names. Do not require WPS/Excel and do not use stale JSON/CSV as final evidence. Do not modify source Excel files unless the user explicitly asks for in-place edits; write audit reports, candidates, and supplements to separate output paths.
  4. Veterinary-standard gate: before any 兽药购进记录 final conclusion, load references/兽药使用标准.xlsx or the explicit newer standard supplied by the user. Match primarily by 批准文号; use 通用名称 only as a secondary sanity check. Do not use the archive workbook's 辅助用表 as final standard evidence when the independent standard has the approval number.
  5. Normalization gate: standardize dates, house ranges, quantities, units, drug/feed names, aliases, approval numbers, production batches/dates, source rows, and issue keys before comparing.
  6. Daily-report gate: parse formatted F22/F23/生产日报 and 日报数值 dynamically; sample-check date blocks, house ages, stock, death/cull, remarks, and bottom notes. If 日报数值 is shifted or the parser produces obvious anomalies, stop business output and fix the daily baseline first.
  7. Sheet-coverage gate: enumerate every expected business sheet. For each present sheet, run the fixed口径 below cell by cell; for absent/empty sheets, report only when the current source evidence or user scope requires that sheet.
  8. Field-order gate: unless the user gives a narrower scope, inspect sheets in this fixed business order: 兽药购进记录 with ERP 调拨入库, 饲料和饲料添加剂购进记录 with ERP 调拨入库, 兽药使用记录 with ERP 领料出库/物料领料出库, 畜禽疾病诊疗记录, 配合饲料使用记录 with ERP 领料出库/物料领料出库, 生产记录(按变动记录), 畜禽免疫记录, 病死畜禽无害化处理记录, 畜禽防疫及质量监测记录, and 消毒记录. Every non-empty business cell must be checked for correct date, object, quantity, unit, name, house, age, batch/production date, and source evidence as applicable.
  9. Cross-check gate: compare use-side records to production daily reports first; then compare purchase-side records to independent standards, labels, purchase ledgers, and ERP 调拨入库; then run full FIFO/coverage replay for veterinary drug batches and feed/additive production dates. If any candidate involves 生产批号, 产品批号, 疫苗批号, 生产日期, 厂家生产或自加工日期, missing purchase batch, future batch, or FIFO coverage, automatically complete the full FIFO/original purchase-batch closure before final output; do not leave the result at candidate screening. If an ERP record file is provided, automatically run ERP-to-ledger reconciliation for veterinary drug/feed purchase and use; do not wait for a separate prompt. For veterinary-drug use shortages, first confirm ERP product-level use total is greater than the ledger use total after excluding 调拨出库; total-balanced daily shifts are date-difference evidence, not 少使用. For net-short products, expand ledger use rows from 使用日期 to 停药日期 and identify the exact dates where ERP daily use exceeds the ledger daily allocation. Mandatory batch-closure rule: every养殖档案检查 must include complete FIFO/original purchase-batch closure confirmation (完整 FIFO/原始购进批号闭合确认) for veterinary-drug batches, vaccine batches, and feed/additive production dates, even when the user does not explicitly ask for batch checking.
  10. Evidence gate: every final issue must have original-source evidence, a concrete rule, object/date/house/product, correct value or missing field, and no unresolved pending dependency.
  11. Final gate: dedupe by date + sheet + row/house + product + rule, remove WARN/pending/unsupported items unless requested, re-open original evidence for each new issue, then output整改句 first.

After every completed audit/check, send the complete final整改问题清单 directly in chat by default, including every final issue sentence. If pending/待核实 issues were produced, send them in a separate 待核实问题 section after the final list unless the user explicitly asks for final-only output. Report file paths, counts, CSV/JSON/TXT workbooks, and summaries are supplemental only; never reply with only paths or only a count/summary unless the user explicitly requests files-only or summary-only output. When the issue set changes during an iterative check, send the full current problem list, not only newly added or removed differences.

Logic Order

The dependency graph is fixed:

  • Production daily reports provide the baseline for same-day house stock, age, daily drug/feed use, death/cull, remarks, and zero-stock errors.
  • Use ledgers depend on the daily baseline: 兽药使用记录, 配合饲料使用记录, diagnosis, immunization, production, dead-disposal, and quality-monitoring counts must be checked against same-date/same-house daily evidence before purchase-side conclusions.
  • Purchase ledgers and independent standards/labels provide product identity: approval number, manufacturer, spec, package spec, withdrawal period, unit, batch, expiry, purchase location, and purchaser.
  • ERP 调拨入库 reconciles purchase-side quantity/date/name. When ERP records are provided, run ERP comparison by default. ERP exports can include supplies/equipment, so exclude obvious non-veterinary materials before reporting 兽药购进记录 differences. For use-side checks, count only 领料出库/物料领料出库; 调拨出库 is退库 and not actual use. When a veterinary-drug use shortage is found, split multi-day ledger rows across the covered dates and report which exact dates are short; only products with ERP use total greater than ledger use total should be labeled 少使用.
  • Classify ERP differences before final output: high-confidence archive omissions/date/quantity differences become final整改句; name/unit/scope ambiguities remain pending; obvious non-veterinary or tool/supply materials are filtered out.
  • FIFO/coverage is a full-ledger replay layer after both purchase and use facts are parsed. Veterinary drugs replay by normalized drug + approval/product pool + unit + production batch. Feed/additives replay by product/alias + production date + unit.
  • Specialized skills and D:\codex101 scripts are subordinate checks. Use them for dosage, contraindication, label, prescription-slip, ERP-ledger, or production-stock details, but still pass this skill's source, evidence, and final gates.

Evidence Priority

  • F22/F23/生产日报/日报数值: date, house, age, female/male/total stock, daily drug/feed use, remarks, and daily death/cull counts.
  • Farm archive workbook sheets: formal purchase/use/treatment/immunization/production/disinfection/dead-disposal/quality-monitoring ledgers.
  • Built-in or user-provided 兽药使用标准: approval-number source of truth for veterinary drug generic name, manufacturer, spec/content, package spec, withdrawal period, and 生产厂家对应代理商; for 兽药购进记录, 购货地点 must match 生产厂家对应代理商 unless a user-confirmed date-based purchase-location override below applies.
  • ERP original workbook: use 调拨入库 for purchase-side reconciliation; use feed/vet outbound records only as supporting evidence when the user asks or the script scope clearly includes them.
  • Labels, screenshots, and user confirmations: authoritative when they conflict with helper formulas or stale auxiliary data.
  • Helper columns/formulas: hints, not final conclusions.

When both 日报数值 and formatted production reports exist, sample-check date blocks, house ages, and stock. If 日报数值 is shifted, duplicated, or incomplete, use the formatted F22/F23 original report.

Parsing Rules

  • Normalize dates to YYYY-MM-DD; support Chinese dates, Excel dates, and slash/dot formats.
  • Merge adjacent numeric and unit cells, such as 20 + or 24.96 + kg.
  • Normalize units: Kg/kg/KG -> kg; L/l -> L; preserve 瓶/支/袋/片 where count units matter.
  • Expand house text such as H7,H10-H13, H1、H4-H12, 1-14栋, 2、3、6栋, and slash-separated forms.
  • Use Unicode-safe paths or filesystem enumeration for Chinese paths in PowerShell/Python.
  • Parse daily reports dynamically by locating headers/date blocks; do not assume fixed rows or fixed column counts.
  • Keep Excel source rows in machine reports even when user-facing问题句 omits row numbers.

Core Checks

当前固定核对口径

Use this user-confirmed checklist as the default scope for ordinary养殖档案核对:

  • Fixed field-level order: 兽药购进记录(ERP调拨入库) -> 饲料和饲料添加剂购进记录(ERP调拨入库) -> 兽药使用记录(ERP领料出库/物料领料出库) -> 畜禽疾病诊疗记录(处方药使用前一天填写) -> 配合饲料使用记录(ERP领料出库/物料领料出库) -> 生产记录(按变动记录) -> 畜禽免疫记录 -> 病死畜禽无害化处理记录 -> 畜禽防疫及质量监测记录 -> 消毒记录.
  • 兽药购进记录: use approval number to match the independent 兽药使用标准 from the user or bundled references/兽药使用标准.xlsx, then check purchase date, generic name, manufacturer, approval number, production batch, spec/content, package spec, quantity/unit, expiry date, purchase location, and purchaser. 购货地点 must equal the standard workbook column 生产厂家对应代理商 unless a user-confirmed date-based purchase-location override below applies; do not substitute the production manufacturer when that column differs. Do not use the current workbook's 辅助用表 as the final standard unless the user explicitly says the independent standard is unavailable or the approval number is absent from the standard. Quantity must be positive; expiry must parse and be no earlier than purchase date. If package spec lacks label evidence, keep it as pending instead of final error.
  • 兽药使用记录: check use date, generic name, product approval number, product batch, medication group/house, group quantity, age, usage method, total used amount, unit, withdrawal period, and stop date. Approval number is verified by matching generic name + product batch back to 兽药购进记录; use date/name/house/method/total/stop date are checked against the production daily report. Group quantity uses same-day same-house stock; age uses same-day same-house age; withdrawal period uses approval number against the independent 兽药使用标准; total used amount sums the continuous daily-report use; product batch uses purchase-ledger FIFO.
  • User-confirmed disinfectant-supply purchase-only rule: products listed in references/special-rules.md under "Disinfectant Supplies Purchase Only" are filled in purchase records only and are not required to appear in 兽药使用记录. Do not report missing 兽药使用记录, use-side ERP shortages, daily-use, group-count, stop-date, or veterinary FIFO issues for those products unless the user explicitly changes scope. Purchase-side 兽药购进记录/ERP 调拨入库 checks still apply.
  • 畜禽疾病诊疗记录: check diagnosis time, house category, age, affected count, cause/symptom, diagnostician, generic drug name, medication method, and diagnosis result. For prescription-drug use, first check whether a diagnosis record exists on the day before the veterinary-drug use date for the same or inferable houses/drug; then verify the diagnosis row itself. Affected count uses diagnosis-date same-house daily-report stock; age uses diagnosis-date same-house daily-report age. Do not force diagnosis-day affected count to equal the next-day 兽药使用记录 group quantity: the diagnosis row and the veterinary-use row each use their own record date's same-house stock baseline.
  • 畜禽免疫记录: check immunization date, house category, stock count, actual immunized count, immunization age, vaccine generic name, manufacturer, vaccine batch, route, and dose. Stock/actual count use same-day same-house daily-report stock; actual count must not exceed stock; vaccine batch is traced back to 兽药购进记录.
  • For 畜禽免疫记录, an immunization-age difference of 1 day is still reportable when same-day same-house production-report age evidence is available.
  • For 畜禽免疫记录 stock count or actual immunized count errors, output as 日期畜禽免疫记录{栋舍}免疫{疫苗名}{字段名}错填写为“原值”,按生产日报当日{栋舍}存栏应填写为“正确值”。; do not use 疫苗名{字段名}填写为“原值”错误.
  • 饲料和饲料添加剂购进记录: check purchase date, product name, manufacturer, approval number or review certificate number, production date, medicated-additive name/content when present, quantity, unit, purchase location, and purchaser. Quantity must be positive and must close with ERP 调拨入库 when ERP is provided; use ERP to find missing purchase rows and quantity/date differences. Unit must follow the product standard table, label, or confirmed inbound record. Do not force all feed additives to kg/千克; liquid products such as 复合维生素维乐多80 may correctly use L when the standard table says L. Do not make final approval/certificate/unit errors without label, standard, or confirmed source evidence.
  • 配合饲料使用记录: check receiving date, manufacturer, feed name, production date, received quantity, unit, house category, fed animal count, per-kg medicated-additive field, planned stop age, and keeper signature. Production date is a required field; if 生产日期/厂家生产或自加工日期 is blank, report 生产日期未填写 before any FIFO or coverage replay instead of silently skipping the row. Production date is matched to 饲料和饲料添加剂购进记录 by FIFO; fed count uses female stock for hen feed, male stock for rooster feed, and female + male total stock for additives. User-confirmed feed purchase/use timing rule: purchased feed and feed additives may be used on the purchase date or the next day. Do not require same-day purchase/use matching; check product type/name, production date, and corresponding quantity closure within this one-day-after-purchase window.
  • 消毒记录: check disinfection date, disinfectant generic name, manufacturer, production batch when required, concentration/ratio, method, and target. If production batch is present, trace the batch back to 兽药购进记录 and compare name/manufacturer.
  • 生产记录(按变动记录): check date, house category, birth/transfer-in/import/transfer-out/sale/death-cull fields, and stock. Blank movement fields are treated as zero. Recurrence is previous stock + transfer-in/import - transfer-out/sale - death/cull = current stock; also compare current stock with same-day production daily total stock and the daily-report 当日存栏=母鸡+公鸡 rule. If the previous effective stock baseline is missing, keep the recurrence check as pending/WARN instead of forcing a final error.
  • 病死畜禽无害化处理记录: check treatment date, house category, dead age, dead quantity, reason, method, treatment unit, and responsible person. Quantity is summed from production daily report death + cull for the same houses and age range.
  • 粪便及污染物无害化处理记录: check date, type, quantity, treatment method, treatment location, treatment unit, and responsible person. Quantity must be positive; type must match method, e.g. medical waste uses harmless treatment and manure transfers to organic fertilizer handling.
  • 畜禽防疫及质量监测记录: check sampling date, house number, sample quantity, sample base, monitoring item, monitoring unit, result, and report number. Sample base is checked against production daily stock for the sampling date and the filled houses; result should be normal unless supported by a report.
  • 产品销售记录: check sale date, product name, sale age, unit, quantity, destination, broker/contact, and quarantine certificate number when sales rows exist. Do not report missing sales if the sheet has no sale event in the current source evidence.
  • 监督检查记录: when present, check structural completeness and required identity fields such as subject name, legal/contact person, phone number, stock, inspector, and inspection date. If the sheet is absent or empty, report only when the current task explicitly requires supervision-inspection records.

兽药使用

  • Match by same date range, house set, normalized drug name, dose, unit, age, stop date, and total amount.
  • Product approval number in 兽药使用记录 must be checked by tracing the generic name + product batch back to 兽药购进记录; do not rely only on the approval number typed in the use row.
  • 群体用药数量 must match the veterinary-use record date's same-day same-house production-report stock. For prescription drugs, the previous-day diagnosis record is required as the treatment basis, but its affected count is checked against the diagnosis date only and is not a replacement for the next-day use quantity.
  • Multi-day use must fill the complete age range from start to stop. Single representative age is acceptable only for same-day multi-house records when it falls inside the same-day house age range.
  • Stop date must be derived from start date plus actual use duration, considering 用N天, 连用N天, 第N天, segmented method text, and explicit age/date ranges.
  • For split-flock batches that later merge into one production daily report, if a 兽药使用记录 or 配合饲料使用记录 row starts before the merge date and involves changing age or stop age, calculate the stop age as start age + use days - 1; do not use the post-merge unified daily-report age to extend or truncate the original split-flock age range.
  • 休药期 must be checked by product approval number against the drug standard/auxiliary table. If the standard has no value or label is required, keep the finding pending.
  • If daily report has continuous use and the ledger has no covering record, report missing use by date range, houses, drug, and daily-report total.
  • Before reporting total-dose mismatch, list or internally verify contribution details: daily file, date, house, row, amount, unit, and total.
  • If a use row appears unmatched or only partially matched to the production daily report, first inspect bottom remarks, total rows, merged/neighboring cells, and free-text house+dose notes for the same dates before outputting any issue. Do not use vague wording such as 生产日报匹配不完整,使用总量需人工复核; either convert it into a concrete issue with missing date/house/value evidence, or delete it when remarks close the total.
  • When parsing production-report remarks, strip parenthetical active-ingredient/specification numbers before extracting drug/feed use. Values such as 林可霉素33.3g大观霉素66.7g are content specs, not house numbers or daily dose evidence.
  • Do not report missing manufacturer in 兽药使用记录; that field is not required there.

兽药购进和ERP

  • Use approval number as the main key when checking name, manufacturer, spec, package spec, and purchase location against the independent 兽药使用标准, labels, or confirmed evidence. The bundled default standard is references/兽药使用标准.xlsx; load it for every ordinary archive audit unless the user provides a newer standard. Do not use the farm workbook's 辅助用表 as final evidence unless no independent standard is available or the approval number is absent from the standard and the user approves fallback.
  • For 购货地点, compare the ledger value to 兽药使用标准 column 生产厂家对应代理商 after applying user-confirmed date-based overrides. If the ledger repeats the 生产厂家 but the resolved expected agent differs, report 购货地点错填写.
  • User-confirmed purchase-location override: for veterinary drugs whose 生产厂家 is 礼蓝(四川)动物保健有限公司, purchase dates before 2026-01-01 should use 郑州市小牛生物科技有限公司 as 购货地点; purchase dates on or after 2026-01-01 should use 郑州市硕牛生物科技有限公司. This date-based rule overrides the bundled 兽药使用标准 value for this manufacturer.
  • User-confirmed purchase-location override: for 戊二醛癸甲溴铵溶液, purchase dates before 2026-03-24 should use 河北科星药业有限公司 as 购货地点; purchase dates on or after 2026-03-24 should use 江西派尼生物药业有限公司. This date-based rule overrides the bundled 兽药使用标准 value for this product.
  • User-confirmed purchase-location override: for 过硫酸氢钾复合物粉 with approval number (2021) 外兽药证字09号, purchase dates before 2026-03-23 should use 河南正佳牧业有限公司 as 购货地点; purchase dates on or after 2026-03-23 should use 河南希让生物科技有限公司. This date-based rule overrides the bundled 兽药使用标准 value for this approval number.
  • Quantity cannot be only a bare number when the ledger requires a unit. Powders/granules usually use kg, oral liquids/solutions use L, and injectables may use 瓶/支.
  • Reconcile formal purchase records with ERP 调拨入库 using a practical default of same/similar name and nearby date, usually within one week.
  • ERP 调拨出库 is退库 and must not be counted as actual use; inventory snapshots and unrelated intermediate tables are not purchase or use evidence unless the user explicitly asks to include them.

批号/生产日期 FIFO

  • Treat complete FIFO/original purchase-batch closure confirmation (完整 FIFO/原始购进批号闭合确认) as a required part of every养殖档案检查. Whenever the task is an养殖档案 check, says 核对批号, or a script/manual pass emits a batch/production-date candidate, re-open the current original purchase and use ledgers, replay the complete FIFO chain, and either output a concrete整改句 or explicitly suppress it as closed/unsupported.
  • For veterinary drugs, identify inventory by normalized drug + approval number/product equivalence + unit; check the 生产批号 stock chain.
  • Replay the complete purchase/use ledger from the first purchase. Do not decide from only the current row's nearby purchases.
  • Quantity deduction must use the parsed number + unit value. If the quantity or unit cannot be parsed, do not skip FIFO silently; either fix the parser from the original cell evidence or keep the batch result pending until the quantity is resolved.
  • The FIFO pool must include all historical 兽药购进记录 and all earlier 兽药使用记录 for the same normalized veterinary drug + approval number/product equivalence + unit, across years and across batches. Never restrict the calculation to the current year, current purchase batch, target batch, or visible nearby rows.
  • A batch error is not final unless the calculation can explain how the expected batch's opening balance was produced from earlier purchases minus earlier uses. When reporting, include at least the current use amount, expected batch/group balance before use, deducted amount, and remaining balance.
  • For 兽药使用记录, the closure must trace each written 产品批号 back to 兽药购进记录 by normalized drug + approval/product equivalence + unit + batch, then replay purchases and all prior uses up to the current use date. If the written batch never appears in current original purchases, state that no corresponding purchase record exists and provide the expected available batch and balance from FIFO when calculable.
  • For 畜禽免疫记录, trace each 疫苗批号 to same-vaccine/same-manufacturer 兽药购进记录 with purchase date on or before immunization date, then replay earlier immunization/use deductions before reporting.
  • For 配合饲料使用记录, trace each 生产日期/厂家生产或自加工日期 to 饲料和饲料添加剂购进记录 by product/alias + unit + production date, then replay earlier feed/additive uses before reporting missing, future, or wrong production-date findings.
  • When a prior use row has sufficient same-day/prior FIFO stock but a wrong batch was written, later replay should deduct the corrected expected batch to avoid duplicate downstream errors. When a prior use row is short as of the use date and the written batch appears only in a later purchase, report that earlier shortage/future-batch issue and reserve/deduct the written later batch for subsequent replay so it does not create a false old-batch residual.
  • For a shortage/future-batch issue, do not use vague wording such as 实际填写的其他批号需核实购进日期或批号. State the concrete written batch, its purchase-record row/date, and that the purchase date is later than the use date, or state that no usable purchase record exists as of the use date.
  • User-confirmed tolerance: if the written veterinary-drug batch or feed/additive production-date lot was purchased after the use date but within 3 calendar days, ignore the shortage/future-batch issue and still deduct/reserve that written batch/lot for later FIFO replay. Report only when the purchase date is more than 3 days after the use date or no matching purchase is found.
  • If cumulative purchases for an older purchase window equal cumulative uses through a later date, do not carry a small multi-batch residual into later findings unless the residual is supported by batch-level allocation evidence. Reconcile sub-kg residuals against actual written batches and purchase dates before reporting a downstream batch issue.
  • Do not drop purchase rows that contain multiple production batches. Split the row by written batch order when the quantity can be apportioned from packaging or equal batch packs; otherwise keep FIFO as pending instead of forcing a final batch error.
  • Always carry forward small remaining balances. Example pattern: if earlier purchases minus uses leave 2510280101 with 0.8kg, the next use must consume that remainder before the later batch; do not report the older batch as wrong just because a newer purchase exists.
  • Same-day purchases of the same drug/approval/unit are one arrival group; using all group batches or a valid batch inside the group can be acceptable when the quantity does not require multiple batches.
  • Split multi-approval and multi-batch cells by spaces, newlines, commas, Chinese punctuation, semicolons, and slashes.
  • For use rows with multiple approval numbers and multiple production batches, split them and deduct each actual batch from its own approval/manufacturer inventory pool before checking later FIFO; otherwise old batches can falsely carry forward into later issues.
  • Treat user-confirmed depleted batches as closed facts for later checks.
  • For feed/additives, 配合饲料使用记录中的生产日期/厂家生产或自加工日期 is the batch identifier; build the incoming pool from 饲料和饲料添加剂购进记录 and deduct by FIFO.

饲料和添加剂

  • Always check purchase and use sides together: product/alias, production date, quantity/unit, use date, houses, coverage, and plan stop age.
  • For 配合饲料使用记录, production date is the feed/additive batch identifier. Match it to 饲料和饲料添加剂购进记录 by product/alias + unit and FIFO; if one use consumes two incoming batches, both production dates should appear.
  • For 配合饲料使用记录, do a required-field pass before production-date parsing: a blank production date is a final fill-in issue such as 2026年5月4日配合饲料使用记录H1-H8使用混合型饲料添加剂 矿物元素+酸度调节剂+寡糖生产日期未填写,按饲料和饲料添加剂购进记录同产品生产日期应填写“2025.9.9”。
  • For non-WQ additives and premixes, coverage can extend from feed-use date age through 计划停料畜禽日龄; 至淘汰 means continuing coverage.
  • If a matching feed/additive use record exists and only fails coverage because 计划停料畜禽日龄 is too low, report 计划停料畜禽日龄错填写; do not report 未填写记录.
  • Do not let records before the report date range indefinitely cover later daily report use; old stock may already be consumed.
  • Known aliases include 澳龙营养 vs 水溶性复合维生素, 维乐多80, 雅士勇, 科维抗, 强力拜固舒S, 百霉克, and 水溶性维生素E/DL-α-生育酚乙酸酯粉.
  • For WQ base feed, apply the current simplified口径 in special-rules.md before reporting name, count, or FIFO issues.

诊疗、免疫、消毒、生产和病死

  • Prescription drugs need a preceding diagnosis/treatment record. Diagnosis age is based on the diagnosis date, not next-day use.
  • Treatment case count, immunization stock, and immunized count are checked against same-day same-house production-report stock; even a difference of 1 may matter.
  • For 畜禽免疫记录 stock/actual-count findings, put 免疫 before the vaccine name and use 错填写为; include the production-report basis as 按生产日报当日{栋舍}存栏应填写为“正确值”.
  • Immunization 疫苗批号 must be checked against same-vaccine, same-manufacturer purchase batches in 兽药购进记录 with purchase date on or before the immunization date. Normalize known vaccine-name variants before matching.
  • For disinfection records with a production batch, map the batch back to 兽药购进记录 and compare the disinfectant generic name.
  • For production records, maintain a corrected effective stock baseline from the production report when ledger stock is wrong; then infer death/cull quantities.
  • For dead-disposal records, compare the ledger 病死日龄 range against production-report death/cull totals for the same houses and ages.
  • For quality monitoring, use filled house numbers as the lookup entry and compare sample base/stock count to same-day same-house report stock; do not report a house-number issue by itself.

Local Scripts

Prefer reusing existing scripts when the current file structure matches. See source-map.md for paths and intended use.

Efficient rerun rules:

  • For same-farm/same-batch checks, locate a specific existing checker such as audit_xhps2_f26.py, override the current daily-report/archive/ERP/standard paths, and rerun it instead of rewriting equivalent parsing logic.
  • On Windows, avoid embedding Chinese literal paths inside Python code piped through PowerShell. Prefer ASCII parent paths such as D:/ plus Unicode-safe Path.glob() or directory enumeration, and set PYTHONIOENCODING=utf-8 when needed.
  • Use the bundled Codex runtime Python (C:\Users\12064\.cache\codex-runtimes\codex-primary-runtime\dependencies\python\python.exe) for workbook checks, and keep the openpyxl DataValidation.__init__ patch that drops unsupported WPS id attributes.
  • When a reusable checker supports repeated passes, run it at least three times and trust business output only when the hashes/counts are stable. Even then, treat script output as candidates until independent-standard, special-rules, ERP, FIFO, and evidence gates are closed.
  • If a reusable script reads the archive workbook 辅助用表 as the purchase-side standard, override or patch that input to the independent 兽药使用标准.xlsx before trusting purchase-side conclusions.

Common starting points:

  • powershell -ExecutionPolicy Bypass -File D:\12064\Documents\问题流程整理\validate_farm_records.ps1
  • python D:\12064\Documents\问题流程整理\analyze_usage_method.py
  • python D:\codex101\audit_vet_usage.py for daily-report vet-drug dosage/contraindication checks.
  • python D:\codex101\sancha_full_cross_audit.py for the older 三场 auxiliary-table + ERP + daily-report workflow.

Patch scripts only when necessary for the current file layout or corrected口径. Keep current source paths visible in rerun output.

Output Format

Default to Chinese issue sentences, one issue per sentence:

日期 + 表名 + 对象/圈舍 + 问题类型 + 正确值/依据说明

Examples:

  • 2026年4月16日配合饲料使用记录H1-H12使用DL-α-生育酚乙酸酯粉(维生素E)(CWS)饲喂畜禽数量未填写,按生产日报当日H1-H12总存栏应填写“92545”。
  • 2026年4月19日畜禽疾病诊疗记录H2,H4,H6,H8,H10,H12诊断使用注射用头孢噻呋日龄填写错误,正确为“421”。
  • 2026年4月26日畜禽免疫记录H9-H12免疫鸡新城疫、传染性支气管炎二联活疫苗实免数错填写为“33761”,按生产日报当日H9-H12存栏应填写为“34772”。
  • 2026年4月22日兽药购进记录漏填写“甲紫溶液”,ERP调拨入库显示当日入库数量为“30瓶”。
  • 2026年4月20日病死畜禽无害化处理记录H1,H3,H5,H7,H9,H11,H13,H15,H17病死数量错填写为“320”,正确为“321”。

When writing reports, prefer fields:

status, sheet, row, date, house, product, rule_id, evidence, suggestion, sentence

Before Finalizing

  • Re-open original evidence for each new issue.
  • Dedupe by date + sheet + row/house + product + rule.
  • Remove WARN/unsupported items from the final整改清单 unless the user asked for them. Keep pending/待核实 items out of the final整改清单, but output them in a separate 待核实问题 section when the audit produced them.
  • Send the full issue list in the final chat response by default: all final整改问题句 first, then pending/待核实问题 if any. Counts and report paths are supplemental traceability; do not stop at a summary.
  • ERP-generated supplement workbooks, pivot reports, CSV, and JSON are evidence/supporting artifacts. Merge high-confidence ERP findings into the整改句 list; do not respond with only generated file paths unless the user explicitly asks for files only.
  • Do not repeat issues already in 问题.docx or confirmed by the user.
  • If a claimed issue disappears after reading the current workbook, explain the source-file/version mismatch instead of forcing the old issue.
  • When the user points out a missed issue or false positive, identify the failed link in the parsing/reconciliation chain before rerunning, such as date range, bottom remarks, right-side No fallback, unit merge, batch balance, alias matching, or source-version mismatch.
  • For long-tail rules, read special-rules.md before deciding WQ feed, daily remarks, FIFO, zero-stock daily use, production record inference, dead-disposal, or dosage-overage findings.