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:
@@ -23,7 +23,7 @@ import (
|
||||
|
||||
// ============ B5 叫料池 + 叫料单(2026-10-13 定稿) ============
|
||||
//
|
||||
// 池子来源:启用状态(CONFIRMED)的日排产 × 工单工艺组合(flow_combination) × 工艺物料清单(flow_material),
|
||||
// 池子来源:启用状态(CONFIRMED)的日排产 × 工单来源产品工艺的工艺分账(product_process_material),
|
||||
// 按 工位+物料 聚合成 call_pool 行;需求量 = Σ 该工位排产量 × 单台用量 ×(1+损耗率),逐排产行向上取整后求和。
|
||||
// 四数账(一个字段只有一个写者):
|
||||
// req_qty 需求 [写者:排产派生重算]
|
||||
@@ -34,7 +34,7 @@ import (
|
||||
// 叫料单七态:PENDING 待备料 → SHIPPED 已发货 → DONE 已完成(签收);
|
||||
// 分支终态 CANCELLED(待备料撤销)/REJECTED(仓库拒发);退库 RETURNING → RETURNED(仓库确认收回,仅签收前)。
|
||||
|
||||
// BorrowSource 同工序候选工位的某物料可借明细(供工位端手动分配借料来源)
|
||||
// BorrowSource 同工艺候选工位的某物料可借明细(供工位端手动分配借料来源)
|
||||
type BorrowSource struct {
|
||||
StationNo int `json:"stationNo"`
|
||||
Avail int `json:"avail"`
|
||||
@@ -52,8 +52,8 @@ type CallPoolRow struct {
|
||||
SentQty int `json:"sentQty"`
|
||||
ReservedQty int `json:"reservedQty"`
|
||||
AvailQty int `json:"availQty"`
|
||||
BorrowAvail int `json:"borrowAvail"` // 同工序其他工位对该物料的可借剩余额度(仅供前端提示与限额)
|
||||
BorrowSources []BorrowSource `json:"borrowSources"` // 同工序其他工位该物料的可借明细(stationNo→可用),供手动分配借料
|
||||
BorrowAvail int `json:"borrowAvail"` // 同工艺其他工位对该物料的可借剩余额度(仅供前端提示与限额)
|
||||
BorrowSources []BorrowSource `json:"borrowSources"` // 同工艺其他工位该物料的可借明细(stationNo→可用),供手动分配借料
|
||||
CrossDay bool `json:"crossDay"`
|
||||
PlanDates string `json:"planDates"`
|
||||
}
|
||||
@@ -348,7 +348,7 @@ func (s *Service) recomputePoolStations(ctx context.Context, stationNos []int) (
|
||||
return changed, nil
|
||||
}
|
||||
|
||||
// StationPool 查某工位的叫料池行(叫料页;可用量 + 同工序可借额度派生)。
|
||||
// StationPool 查某工位的叫料池行(叫料页;可用量 + 同工艺可借额度派生)。
|
||||
func (s *Service) StationPool(ctx context.Context, stationNo int) ([]CallPoolRow, error) {
|
||||
rows, err := s.ctx.EntClient.CallPool.Query().
|
||||
Where(callpool.StationNo(stationNo)).
|
||||
@@ -356,7 +356,7 @@ func (s *Service) StationPool(ctx context.Context, stationNo int) ([]CallPoolRow
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// 同工序候选工位对该物料的可借剩余额度明细(仅同 FlowId 的启用工位之间可借;且须基础设置开启借料)
|
||||
// 同工艺候选工位对该物料的可借剩余额度明细(仅同 FlowId 的启用工位之间可借;且须基础设置开启借料)
|
||||
borrowByMat := map[string]int{}
|
||||
borrowSrcByMat := map[string][]BorrowSource{}
|
||||
if allowBorrow := s.CfgInt(ctx, CfgAllowBorrow, 1) == 1; allowBorrow {
|
||||
@@ -475,7 +475,7 @@ func (s *Service) CreateCallOrders(ctx context.Context, stationNo int, items []C
|
||||
if !s.stationHasEnabledLineDock(ctx, s.ctx.EntClient, stationNo) {
|
||||
return 0, errors.New("该工位无接驳台(虚拟/线下工位),不支持叫料")
|
||||
}
|
||||
// 同工序候选工位(同 FlowId、启用、非本工位):本工位不足时向其借用剩余额度
|
||||
// 同工艺候选工位(同 FlowId、启用、非本工位):本工位不足时向其借用剩余额度
|
||||
sibNos := []int{}
|
||||
if st.FlowId > 0 {
|
||||
if sibs, e := s.ctx.EntClient.Station.Query().
|
||||
@@ -639,7 +639,7 @@ func (s *Service) CreateCallOrders(ctx context.Context, stationNo int, items []C
|
||||
}
|
||||
} else if it.Qty > ownAvail {
|
||||
// 未借料但本工位不足(前端 max 已限制,这里兜底拦截)
|
||||
return created, fmt.Errorf("%s 自身可用 %d 不足(请求 %d),请开启借料或从同工序工位借料", it.MaterialCode, ownAvail, it.Qty)
|
||||
return created, fmt.Errorf("%s 自身可用 %d 不足(请求 %d),请开启借料或从同工艺工位借料", it.MaterialCode, ownAvail, it.Qty)
|
||||
}
|
||||
reqNo := fmt.Sprintf("MR%d", ts+int64(created))
|
||||
// 工单×排产日明细拆分(2026-11-05 拍板:物料挂工单;池聚合层不动,明细层补留)
|
||||
|
||||
Reference in New Issue
Block a user