style(formatter): 格式化代码中的缩进和空行

- 统一了结构体字段的对齐方式,保持一致的缩进
- 调整了 import 语句的顺序,将 fmt 移至合适位置
- 修复了多处多余的空行和空白字符
- 规范化了注释的缩进格式
- 整理了路由配置的缩进层次
- 调整了常量定义的对齐格式
This commit is contained in:
SunYF
2026-09-20 14:53:14 +08:00
parent f35e9b5b75
commit 60eacc9c4f
10 changed files with 66 additions and 62 deletions
+13 -12
View File
@@ -44,11 +44,11 @@ func semiInboundHandler(ctx *svc.ServiceContext) http.HandlerFunc {
Category int `json:"category"` // 2=半成品 3=成品(默认 2
OwnershipType string `json:"ownershipType"`
OwnershipNo string `json:"ownershipNo"`
ProductStatus string `json:"productStatus"` // 已通过/部分通过/返修(成品用)
RelatedStandard string `json:"relatedStandard"` // 相关标准(试验方案号)
TestRecordNo string `json:"testRecordNo"` // 试验记录单号
RecordedBy string `json:"recordedBy"` // 记录员
RecordedAt int64 `json:"recordedAt"` // 记录日期(unix 秒)
ProductStatus string `json:"productStatus"` // 已通过/部分通过/返修(成品用)
RelatedStandard string `json:"relatedStandard"` // 相关标准(试验方案号)
TestRecordNo string `json:"testRecordNo"` // 试验记录单号
RecordedBy string `json:"recordedBy"` // 记录员
RecordedAt int64 `json:"recordedAt"` // 记录日期(unix 秒)
}
if err := parseJSON(r, &req); err != nil {
fail(w, http.StatusBadRequest, "参数错误")
@@ -119,7 +119,7 @@ func semiInboundHandler(ctx *svc.ServiceContext) http.HandlerFunc {
SetNillableTestRecordNo(strPtr(req.TestRecordNo)).
SetNillableRecordedBy(strPtr(req.RecordedBy)).
SetNillableRecordedAt(int64Ptr(req.RecordedAt)).
SetRemark(catLabel+"完工暂存回流").
SetRemark(catLabel + "完工暂存回流").
Save(ctx0())
if err != nil {
fail(w, http.StatusInternalServerError, err.Error())
@@ -305,11 +305,12 @@ type ledgerRow struct {
// ledgerState 备料四态判定(客户诉求 问题记录 L242-258 孙彦飞口径),优先级:未到货 > 预警 > 未齐套 > 齐套。
//
// 状态定义(L253-256):
// 齐套 :可用库存 ≥ 需求总量
// 未齐套:0 < 可用库存 < 需求总量
// 未到货:可用库存 = 0 且 已出库 = 0
// 预警 :可用库存 < 未来5天需求量(future5Qty 由 MES 按近5天日排产×单台用量推送到 material_demands
// 无推送记录时 future5Qty=0,该档不生效,退化为三态判定)
//
// 齐套 可用库存 需求总量
// 未齐套:0 < 可用库存 < 需求总量
// 未到货:可用库存 = 0 且 已出库 = 0
// 预警 :可用库存 < 未来5天需求量(future5Qty 由 MES 按近5天日排产×单台用量推送到 material_demands
// 无推送记录时 future5Qty=0,该档不生效,退化为三态判定)
func ledgerState(avail, need, out, future5Qty int) string {
if avail <= 0 && out <= 0 {
return "未到货"
@@ -375,7 +376,7 @@ func queryLedgerHandler(ctx *svc.ServiceContext) http.HandlerFunc {
materialCode := r.URL.Query().Get("materialCode")
materialName := r.URL.Query().Get("materialName")
status := r.URL.Query().Get("status")
state := r.URL.Query().Get("state") // 四态筛选:齐套/未齐套/预警/未到货
state := r.URL.Query().Get("state") // 四态筛选:齐套/未齐套/预警/未到货
completeStart := r.URL.Query().Get("completeStart") // 完成时间起(YYYY-MM-DD
completeEnd := r.URL.Query().Get("completeEnd") // 完成时间止
page := atoi(r.URL.Query().Get("page"), 1)