fix: rebuild MES as compilable go-zero+ent backend (renamed bj_power_mes), restore 3 workstation projects from pristine original, align naming; all Go projects go build clean

This commit is contained in:
SunYF
2026-08-27 10:56:41 +08:00
parent 380715f8a9
commit 371b494c54
523 changed files with 67923 additions and 24758 deletions
+24
View File
@@ -0,0 +1,24 @@
package mom
import (
"context"
"fmt"
"bj_power_mes/ent"
"bj_power_mes/ent/producttype"
)
// MatchProductType 通过 product_type.name 匹配 MOM 的 ProdModelV_WO_PROD.PROD_MODEL)。
// 返回 nil 表示未找到匹配的产品类型。
func MatchProductType(ctx context.Context, client *ent.Client, prodModel string) (*ent.ProductType, error) {
pt, err := client.ProductType.Query().
Where(producttype.NameEQ(prodModel), producttype.IsActive(true)).
First(ctx)
if err != nil {
if ent.IsNotFound(err) {
return nil, nil
}
return nil, fmt.Errorf("match product type %s: %w", prodModel, err)
}
return pt, nil
}