feat: 重构入库流程,支持序列号与类型解耦,新增通用入库组件

- 重构物料档案字段:将"序列号件"改为"序列号",描述是否有序列号,与类型独立
- 调整入库页逻辑:按物料"序列号"决定记账方式,类型仅用于页签归属
- 新增通用入库组件 InboundEntry,复用三个类型页签的表单逻辑
- 优化成品入库页面,提交后自动切换到入库列表页签
- 修正物料校验提示文案,统一表述为"是否有序列号"
This commit is contained in:
SunYF
2026-10-07 20:00:06 +08:00
parent 756d978900
commit 7c7c16ee6d
20 changed files with 621 additions and 759 deletions
+14 -10
View File
@@ -8,7 +8,7 @@ import (
"bj_power_mes/ent"
"bj_power_mes/ent/dailyplan"
"bj_power_mes/ent/station"
"bj_power_mes/ent/dock"
"bj_power_mes/ent/workorder"
"bj_power_mes/ent/workpiece"
)
@@ -206,8 +206,9 @@ func (s *Service) saveDailyPlanBatch(ctx context.Context, req DailyPlanReq, oper
return nil
}
// SuggestedDockCodes 查工单工艺组合覆盖工位的接驳台编码(DOCKxx),供排产/备料默认推荐。
// 路线唯一源头 = 工单 flow_combination(按工位号升序),接驳台取 station.dock_code。
// SuggestedDockCodes 查工单工艺组合覆盖工位的接驳台编码,供排产/备料默认推荐。
// 路线唯一源头 = 工单 flow_combination(按工位号升序);接驳台真源 = dock 表(按 station_no 聚合,
// 一个工位可配 R1/R2 多个接驳台),station.dock_code 仅默认兜底,故统一从 dock 表取全集。
func (s *Service) SuggestedDockCodes(ctx context.Context, orderNo string) []string {
wo, err := s.ctx.EntClient.WorkOrder.Query().Where(workorder.WorkOrderNo(orderNo)).First(ctx)
if err != nil {
@@ -217,16 +218,19 @@ func (s *Service) SuggestedDockCodes(ctx context.Context, orderNo string) []stri
if len(items) == 0 {
return nil
}
sts, err := s.ctx.EntClient.Station.Query().Where(station.StationNoIn(RouteStationsOfWO(items)...)).All(ctx)
docks, err := s.ctx.EntClient.Dock.Query().
Where(dock.StationNoIn(RouteStationsOfWO(items)...), dock.DockTypeEQ("line")).
Order(ent.Asc(dock.FieldStationNo), ent.Asc(dock.FieldDockCode)).
All(ctx)
if err != nil {
return nil
}
seen := map[string]bool{}
out := []string{}
for _, st := range sts {
if st.DockCode != "" && !seen[st.DockCode] {
seen[st.DockCode] = true
out = append(out, st.DockCode)
for _, d := range docks {
if d.DockCode != "" && !seen[d.DockCode] {
seen[d.DockCode] = true
out = append(out, d.DockCode)
}
}
return out
@@ -357,8 +361,8 @@ func (s *Service) ListDailyPlansPaged(ctx context.Context, planDateStart, planDa
// UnplannedWorkOrder 未排产工单(供日排产页「未排产」入口展示)
type UnplannedWorkOrder struct {
OrderNo string `json:"orderNo"`
ProductTypeId int `json:"productTypeId"`
OrderNo string `json:"orderNo"`
ProductTypeId int `json:"productTypeId"`
Quantity int `json:"quantity"`
DueDate string `json:"dueDate"`
Status string `json:"status"`