feat: 大屏多订单改为同屏并列展示,物料申请新增跨工位借料来源并移除工单完成日期
This commit is contained in:
@@ -8,15 +8,22 @@ import (
|
||||
"bj_power_mes/internal/svc"
|
||||
)
|
||||
|
||||
// StartAlertScanner 预警定时扫描器:每小时扫描一次工单超期(task_overdue),
|
||||
// StartAlertScanner 预警定时扫描器:每小时扫描一次(工单超期 task_overdue /
|
||||
// 叫料备料超时 call_overdue / AGV 派车失败 agv_failed),
|
||||
// 服务启动后立即扫描一次。各扫描项内部自带「规则启用才生效 + 未读去重」,重复运行无副作用。
|
||||
func StartAlertScanner(ctx *svc.ServiceContext) {
|
||||
go func() {
|
||||
ticker := time.NewTicker(time.Hour)
|
||||
defer ticker.Stop()
|
||||
logic.New(ctx).ScanTaskOverdue(context.Background())
|
||||
scanAll(ctx)
|
||||
for range ticker.C {
|
||||
logic.New(ctx).ScanTaskOverdue(context.Background())
|
||||
scanAll(ctx)
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
func scanAll(ctx *svc.ServiceContext) {
|
||||
logic.New(ctx).ScanTaskOverdue(context.Background())
|
||||
logic.New(ctx).ScanCallOverdue(context.Background())
|
||||
logic.New(ctx).ScanAgvFailed(context.Background())
|
||||
}
|
||||
|
||||
@@ -277,7 +277,7 @@ func renderWorkOrderCardPdf(pdf *gofpdf.Fpdf, c *workOrderCard) {
|
||||
rows := [][]string{}
|
||||
for _, s := range c.ProcessSteps {
|
||||
rows = append(rows, []string{
|
||||
strconv.Itoa(s.Seq), s.ProcessName, strconv.Itoa(s.StationNo), s.CollectCN,
|
||||
strconv.Itoa(s.Seq), s.ProcessName, s.StationNo, s.CollectCN,
|
||||
s.ActualStart, s.ActualEnd, s.Operators, s.Status, s.Auditor,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ type woProcessStep struct {
|
||||
Seq int `json:"seq"`
|
||||
ProcessName string `json:"processName"`
|
||||
CollectCN string `json:"collectCN"`
|
||||
StationNo int `json:"stationNo"`
|
||||
StationNo string `json:"stationNo"`
|
||||
PlanHours string `json:"planHours"`
|
||||
ActualStart string `json:"actualStart"`
|
||||
ActualEnd string `json:"actualEnd"`
|
||||
@@ -345,7 +345,8 @@ func buildWorkOrderCard(ctx context.Context, svcCtx *svc.ServiceContext, workOrd
|
||||
|
||||
// 路线:工单工艺组合 → 工位顺序;未配置则全产线已配置工位
|
||||
seq := []int{}
|
||||
if items, _ := logic.RouteStationsFromWO(ctx, client, wo); len(items) > 0 {
|
||||
items, _ := logic.RouteStationsFromWO(ctx, client, wo)
|
||||
if len(items) > 0 {
|
||||
seq = logic.RouteStationsOfWO(items)
|
||||
} else {
|
||||
sts, _ := client.Station.Query().Where(station.FlowIdGT(0)).Order(ent.Asc(station.FieldStationNo)).All(ctx)
|
||||
@@ -357,10 +358,8 @@ func buildWorkOrderCard(ctx context.Context, svcCtx *svc.ServiceContext, workOrd
|
||||
card.ProcessSeqNote = joinInts(seq)
|
||||
|
||||
sts, _ := client.Station.Query().Where(station.StationNoIn(seq...)).All(ctx)
|
||||
stationByNo := map[int]*ent.Station{}
|
||||
flowIds := []int{}
|
||||
for _, s := range sts {
|
||||
stationByNo[s.StationNo] = s
|
||||
if s.FlowId > 0 {
|
||||
flowIds = append(flowIds, s.FlowId)
|
||||
}
|
||||
@@ -438,15 +437,13 @@ func buildWorkOrderCard(ctx context.Context, svcCtx *svc.ServiceContext, workOrd
|
||||
signByStep[s.StepId][s.SignRole] = append(signByStep[s.StepId][s.SignRole], s)
|
||||
}
|
||||
|
||||
// 组装工序实绩行
|
||||
for _, no := range seq {
|
||||
st := stationByNo[no]
|
||||
if st == nil {
|
||||
continue
|
||||
}
|
||||
for _, s := range stepsByFlow[st.FlowId] {
|
||||
key := fmt.Sprintf("%d|%s", st.FlowId, s.Name)
|
||||
ps := woProcessStep{Seq: s.Seq, ProcessName: s.Name, CollectCN: ppCollectCN(s.CollectType), StationNo: no, PlanHours: "-",
|
||||
// 组装工序实绩行(并行候选工位模型:按工序聚合,工位列展示该工序的全部候选工位,避免重复渲染)
|
||||
route := logic.GroupFlowRoute(items)
|
||||
for _, fr := range route {
|
||||
for _, s := range stepsByFlow[fr.FlowId] {
|
||||
key := fmt.Sprintf("%d|%s", fr.FlowId, s.Name)
|
||||
ps := woProcessStep{Seq: s.Seq, ProcessName: s.Name, CollectCN: ppCollectCN(s.CollectType),
|
||||
StationNo: joinInts(fr.Stations), PlanHours: "-",
|
||||
NeedCheck: s.NeedCheck, NeedAudit: s.NeedAudit, AuditRole: s.AuditRole}
|
||||
a := actByKey[key]
|
||||
if a != nil && a.hasRecord {
|
||||
|
||||
@@ -220,7 +220,7 @@ type orderRow struct {
|
||||
func OrderQueryInternalHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
orderNo := r.URL.Query().Get("orderNo")
|
||||
list, err := logic.New(svcCtx).ListWorkOrders(r.Context(), orderNo, "", "", "", "", "", "", "", "", 0)
|
||||
list, err := logic.New(svcCtx).ListWorkOrders(r.Context(), orderNo, "", "", "", "", "", "", 0)
|
||||
if err != nil {
|
||||
httpx.Fail(w, 2004, err.Error())
|
||||
return
|
||||
|
||||
@@ -160,7 +160,7 @@ func ListWorkOrdersHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
}
|
||||
data, err := logic.New(svcCtx).ListWorkOrders(r.Context(),
|
||||
q.Get("orderNo"), q.Get("status"), q.Get("productCode"), q.Get("productName"),
|
||||
q.Get("contractNo"), q.Get("ownershipType"), q.Get("dueFrom"), q.Get("dueTo"),
|
||||
q.Get("contractNo"), q.Get("ownershipType"),
|
||||
q.Get("keyword"), limit)
|
||||
if err != nil {
|
||||
httpx.Fail(w, 3004, err.Error())
|
||||
|
||||
Reference in New Issue
Block a user