feat: 移除工艺物料与混产模板实体、新增产线清线与 PLC 监控实时推送、看板双屏增强
- 移除实体:MES 删除 FlowMaterial(工艺物料)与 MixProductionTemplate(混产模板)全套(schema/ent 生成码/handler/logic),清理关联路由与种子 - 新增功能:产线清线(line_clearance handler + logic)、PLC 监控 WebSocket 实时推送(ws/plc_monitor_hub + handler) - 看板增强:新增管理屏与 KPI 组件(BoardManage/BoardKpi),调整演示屏 Mock 与各看板面板 - MES 完善:PLC 匹配/扭矩扫描/签收、工艺卡 PDF 与工单、AGV 链路、叫料/备料/在制品/短料预测等逻辑与前端调整 - 工位终端:删除离线面板 OfflinePanel,调整主界面/物料面板与 api/store/handler/路由 - WMS:AGV 托盘、物料与 MES 客户端调整及前端帮助/基础数据/叫料/托盘页 - 文档:更新产线API/客户问题/案例/部署手册/问题记录
This commit is contained in:
@@ -22,7 +22,6 @@ import (
|
||||
"bj_power_mes/ent/callpool"
|
||||
"bj_power_mes/ent/dailyplan"
|
||||
"bj_power_mes/ent/dock"
|
||||
"bj_power_mes/ent/flowmaterial"
|
||||
"bj_power_mes/ent/materialrequest"
|
||||
"bj_power_mes/ent/workorder"
|
||||
"bj_power_mes/schema"
|
||||
@@ -324,6 +323,7 @@ func (s *Service) DispatchPalletReturnManual(ctx context.Context, dockCode, oper
|
||||
_, err = s.dispatchAgvSegment(ctx, agvSegInput{
|
||||
Kind: "GO_LOAD", BizType: "PALLET", BizNo: dockCode,
|
||||
Source: "", Target: dockCode, Operator: operator,
|
||||
AutoLoad: true, // 工位终端托盘回库(空托盘):到位即装车免人工确认
|
||||
})
|
||||
if err == nil {
|
||||
s.ctx.EventLog.Write(ctx, "dock.pallet_return", operator, "", "dock", dockCode,
|
||||
@@ -393,7 +393,7 @@ func (s *Service) DispatchDeliveryAgv(ctx context.Context, deliveryNo, targetDoc
|
||||
return nil
|
||||
}
|
||||
|
||||
// StationMaterialDetailRow 工位物料明细行(工艺物料全集 左连接 工位账四数)
|
||||
// StationMaterialDetailRow 工位物料明细行(分账全集 左连接 工位账四数)
|
||||
type StationMaterialDetailRow struct {
|
||||
MaterialCode string `json:"materialCode"`
|
||||
MaterialName string `json:"materialName"`
|
||||
@@ -408,10 +408,15 @@ type StationMaterialDetailRow struct {
|
||||
}
|
||||
|
||||
// StationMaterialDetail 工位物料明细(2026-11-05 拍板:比叫料列表更突出,量为0也显示、
|
||||
// 不分左右托盘):工艺全集 = 活跃工单(下发/进行/暂停)组合中绑定本工位的工艺;
|
||||
// 不分左右托盘):工艺全集 = 活跃工单(下发/进行/暂停)组合中绑定本工位的工艺,
|
||||
// 物料全集 = 各活跃工单来源产品工艺的工艺分账(2026-11-18 纯分账口径);
|
||||
// 池(工位×物料)为记账层,两层并存。
|
||||
func (s *Service) StationMaterialDetail(ctx context.Context, stationNo int) ([]StationMaterialDetailRow, error) {
|
||||
flowIds := map[int]bool{}
|
||||
type oflow struct {
|
||||
wo *ent.WorkOrder
|
||||
fid int
|
||||
}
|
||||
var oflows []oflow
|
||||
wos, _ := s.ctx.EntClient.WorkOrder.Query().
|
||||
Where(workorder.StatusIn("RELEASED", "IN_PROGRESS", "PAUSED")).All(ctx)
|
||||
for _, wo := range wos {
|
||||
@@ -419,9 +424,11 @@ func (s *Service) StationMaterialDetail(ctx context.Context, stationNo int) ([]S
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
fseen := map[int]bool{}
|
||||
for _, it := range items {
|
||||
if it.StationNo == stationNo {
|
||||
flowIds[it.FlowId] = true
|
||||
if it.StationNo == stationNo && !fseen[it.FlowId] {
|
||||
fseen[it.FlowId] = true
|
||||
oflows = append(oflows, oflow{wo: wo, fid: it.FlowId})
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -432,20 +439,18 @@ func (s *Service) StationMaterialDetail(ctx context.Context, stationNo int) ([]S
|
||||
}
|
||||
out := []StationMaterialDetailRow{}
|
||||
seen := map[string]bool{}
|
||||
fidList := make([]int, 0, len(flowIds))
|
||||
for fid := range flowIds {
|
||||
fidList = append(fidList, fid)
|
||||
}
|
||||
sort.Ints(fidList)
|
||||
for _, fid := range fidList {
|
||||
fms, _ := s.ctx.EntClient.FlowMaterial.Query().Where(flowmaterial.FlowId(fid)).All(ctx)
|
||||
for _, fm := range fms {
|
||||
for _, of := range oflows {
|
||||
fmByFlow, err := s.MaterialsByFlowForWO(ctx, s.ctx.EntClient, of.wo, []int{of.fid})
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
for _, fm := range fmByFlow[of.fid] {
|
||||
if fm.MaterialCode == "" || seen[fm.MaterialCode] {
|
||||
continue
|
||||
}
|
||||
seen[fm.MaterialCode] = true
|
||||
row := StationMaterialDetailRow{MaterialCode: fm.MaterialCode, MaterialName: fm.MaterialName,
|
||||
Spec: fm.Spec, Unit: fm.Unit, SnMode: fm.SnMode, FlowName: s.flowNameById(ctx, fid)}
|
||||
Spec: fm.Spec, Unit: fm.Unit, SnMode: fm.SnMode, FlowName: s.flowNameById(ctx, of.fid)}
|
||||
if r := poolBy[fm.MaterialCode]; r != nil {
|
||||
row.ReqQty = r.ReqQty
|
||||
row.AdjQty = r.AdjQty
|
||||
@@ -455,25 +460,21 @@ func (s *Service) StationMaterialDetail(ctx context.Context, stationNo int) ([]S
|
||||
out = append(out, row)
|
||||
}
|
||||
}
|
||||
// 有在途/占用但活跃工艺已不再覆盖的物料也补出(池有、工艺无:显示为「—」工艺)
|
||||
keys := make([]string, 0, len(poolBy))
|
||||
// 池有账但活跃工单分账已不含的物料也补出(显示为「—」工艺)
|
||||
codes := make([]string, 0, len(poolBy))
|
||||
for k := range poolBy {
|
||||
keys = append(keys, k)
|
||||
codes = append(codes, k)
|
||||
}
|
||||
sort.Strings(keys)
|
||||
for _, mc := range keys {
|
||||
sort.Strings(codes)
|
||||
for _, mc := range codes {
|
||||
if seen[mc] {
|
||||
continue
|
||||
}
|
||||
seen[mc] = true
|
||||
r := poolBy[mc]
|
||||
row := StationMaterialDetailRow{MaterialCode: mc, MaterialName: r.MaterialName,
|
||||
Unit: r.Unit, SnMode: r.SnMode, FlowName: "—"}
|
||||
row.ReqQty = r.ReqQty
|
||||
row.AdjQty = r.AdjQty
|
||||
row.SentQty = r.SentQty
|
||||
row.AvailQty = poolAvail(r.ReqQty, r.AdjQty, r.SentQty, r.ReservedQty)
|
||||
out = append(out, row)
|
||||
out = append(out, StationMaterialDetailRow{MaterialCode: mc, MaterialName: r.MaterialName, Unit: r.Unit, SnMode: r.SnMode,
|
||||
ReqQty: r.ReqQty, AdjQty: r.AdjQty, SentQty: r.SentQty, AvailQty: poolAvail(r.ReqQty, r.AdjQty, r.SentQty, r.ReservedQty)})
|
||||
}
|
||||
sort.SliceStable(out, func(i, j int) bool { return out[i].MaterialCode < out[j].MaterialCode })
|
||||
return out, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user