docs: 统一修正全项目“SN管理”相关术语为“序列号”

本次 commit 统一修正了全项目范围内关于 SN 管理的术语表述,将原“SN管理”、“序列号件”、“批次件”等表述调整为“序列号”、“序列号=是”、“序列号=否”,同时同步更新了相关文档、代码注释、前端提示文本、数据库 schema 注释、API 文档等,确保全链路术语统一,消除理解歧义。
This commit is contained in:
SunYF
2026-10-10 15:58:59 +08:00
parent b032f47fc7
commit 8be6e03a15
335 changed files with 5742 additions and 1616 deletions
+13 -13
View File
@@ -69,7 +69,7 @@ func (s *Service) BindWorkpiece(ctx context.Context, sn, orderNo string, flowId
// BindItemReq 单条装机绑定请求(报工时随 steps 一并提交)
type BindItemReq struct {
MaterialCode string `json:"materialCode"`
BindValue string `json:"bindValue"` // 批次件=批次号;序列号件=SN
BindValue string `json:"bindValue"` // 序列号=否=批次号;序列号=是=SN
}
// bindTarget 某工艺要求装配的物料定义(源自工艺物料清单 flow_material)
@@ -78,7 +78,7 @@ type bindTarget struct {
MaterialName string
Spec string
Unit string
SnMode int // 是否逐件SN管理:1 序列号件(录SN) / 2 批次件
SnMode int // 是否逐件SN管理:1 序列号=是(录SN) / 2 序列号=否
UnitQty float64
}
@@ -165,12 +165,12 @@ func (s *Service) applyBinds(ctx context.Context, client *ent.Client, sn, orderN
if exists {
continue
}
// 序列号件 SN 全局防重
// 序列号=是 SN 全局防重
if snMode == 1 {
other, _ := client.WorkpieceBind.Query().
Where(workpiecebind.BindValue(bv), workpiecebind.BindType("SN"), workpiecebind.SnNEQ(sn)).First(ctx)
if other != nil {
return bound, fmt.Errorf("序列号件SN %s 已绑定到工件 %s(工艺「%s」),不能重复装机",
return bound, fmt.Errorf("序列号=是SN %s 已绑定到工件 %s(工艺「%s」),不能重复装机",
bv, other.Sn, s.flowNameById(ctx, other.FlowId))
}
}
@@ -223,11 +223,11 @@ func (s *Service) validateStationBinds(ctx context.Context, client *ent.Client,
if need < 1 {
need = 1
}
if t.SnMode == 1 { // 序列号件 SN:需绑满单台用量
if t.SnMode == 1 { // 序列号=是 SN:需绑满单台用量
if boundCount < need {
missing = append(missing, fmt.Sprintf("%s(%s):需绑定%d颗SN,已绑%d颗", t.MaterialCode, t.MaterialName, need, boundCount))
}
} else { // 批次件:至少绑定1个批次号
} else { // 序列号=否:至少绑定1个批次号
if boundCount < 1 {
missing = append(missing, fmt.Sprintf("%s(%s):未绑定批次号", t.MaterialCode, t.MaterialName))
}
@@ -276,8 +276,8 @@ type InspectionBindItem struct {
MaterialCode string `json:"materialCode"`
MaterialName string `json:"materialName"`
Spec string `json:"spec"`
BindValue string `json:"bindValue"` // 序列号件=SN / 批次件=批次号
BindMode string `json:"bindMode"` // 序列号件 / 批次件
BindValue string `json:"bindValue"` // 序列号=是=SN / 序列号=否=批次号
BindMode string `json:"bindMode"` // 序列号=是 / 序列号=否
Operator string `json:"operator"`
CreatedAt time.Time `json:"createdAt"`
}
@@ -296,9 +296,9 @@ func (s *Service) inspectionBindItems(ctx context.Context, sn string) []Inspecti
}
out := make([]InspectionBindItem, 0, len(binds))
for _, b := range binds {
mode := "批次件"
mode := "序列号=否"
if b.SnMode == 1 {
mode = "序列号件"
mode = "序列号=是"
}
out = append(out, InspectionBindItem{
Sn: b.Sn, FlowName: s.flowNameById(ctx, b.FlowId), StationNo: b.StationNo,
@@ -337,7 +337,7 @@ type BindNode struct {
MaterialName string `json:"materialName"`
Spec string `json:"spec"`
Unit string `json:"unit"`
SnMode int `json:"snMode"` // 1 序列号件 / 2 批次件
SnMode int `json:"snMode"` // 1 序列号=是 / 2 序列号=否
Qty float64 `json:"qty"` // 折算到单台成品的用量
Level int `json:"level"` // 0=顶层装配物料,1+=下级
Children []BindNode `json:"children,omitempty"`
@@ -357,7 +357,7 @@ func (s *Service) BuildBindTrace(ctx context.Context, sn string) (*BindTraceVO,
if err != nil {
return nil, err
}
// 物料组成:按工单工艺组合×工艺物料清单平铺一层(BOM 已删除,无多级树)
// 物料组成:按工单工艺组合×工艺物料清单平铺一层(物料清单已删除,无多级树)
var tree []BindNode
for _, it := range s.WorkOrderUnitUsage(ctx, wo) {
tree = append(tree, BindNode{
@@ -375,7 +375,7 @@ type BindRequiredItem struct {
MaterialName string `json:"materialName"`
Spec string `json:"spec"`
Unit string `json:"unit"`
SnMode int `json:"snMode"` // 1 序列号件(录SN) / 2 批次件
SnMode int `json:"snMode"` // 1 序列号=是(录SN) / 2 序列号=否
UnitQty float64 `json:"unitQty"`
Need int `json:"need"` // 需绑数量
Bound []string `json:"bound"` // 已绑定的批次号/SN 列表