feat: 解耦管理类型与SN管理方式,新增sn_mode字段实现全链路SN管理标准化
本次重构将原manage_mode字段拆分为独立的分类维度(manage_mode)和SN管理维度(sn_mode),实现全链路(MES/WMS/工位终端)的SN管理行为统一依据: 1. 新增sn_mode字段,定义1=序列号件、2=批次件、0=未选择,替代原manage_mode的SN判断逻辑 2. 移除冗余的manage_mode字段在多个实体中的使用,统一使用sn_mode决定业务行为 3. 新增工位接驳台配置,服务端固定接驳台,前端不可修改,确保AGV送达准确性 4. 优化检验记录导出,新增装配物料绑定明细,满足客户追溯需求 5. 修正前端提示文本,统一使用序列号件/批次件表述,与后端逻辑对齐
This commit is contained in:
@@ -111,6 +111,19 @@ func InspectionDisposalHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
}
|
||||
}
|
||||
|
||||
// InspectionBindsHandler GET /inspections/binds?sn= 检验记录详情附带的装配物料绑定明细
|
||||
// (按 SN 跨工艺查 workpiece_bind,标注工艺/工位;客户需求:检验记录附装配明细)
|
||||
func InspectionBindsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
sn := r.URL.Query().Get("sn")
|
||||
if sn == "" {
|
||||
httpx.BadRequest(w, "缺少 sn")
|
||||
return
|
||||
}
|
||||
httpx.Ok(w, logic.New(svcCtx).InspectionBinds(r.Context(), sn))
|
||||
}
|
||||
}
|
||||
|
||||
// UnqualifiedReportHandler GET /quality/unqualified-report?id= 一键生成《不合格单》xlsx 模板(预填检验数据)
|
||||
func UnqualifiedReportHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -140,6 +153,28 @@ func UnqualifiedReportHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
cell, _ := excelize.CoordinatesToCellName(c+1, 2)
|
||||
_ = f.SetCellValue(sheet, cell, v)
|
||||
}
|
||||
// 装配物料绑定明细区(明细下方加区块,照主表风格):该 SN 跨工艺全部装机绑定
|
||||
if rec.Sn != "" {
|
||||
if binds := logic.New(svcCtx).InspectionBinds(r.Context(), rec.Sn); len(binds) > 0 {
|
||||
titleCell, _ := excelize.CoordinatesToCellName(1, 4)
|
||||
_ = f.SetCellValue(sheet, titleCell, "装配物料绑定明细")
|
||||
bindHeaders := []string{"工件SN", "工艺", "工位", "物料编码", "物料名称", "规格", "绑定值(SN/批次)", "绑定方式", "绑定人", "绑定时间"}
|
||||
for c, h := range bindHeaders {
|
||||
cell, _ := excelize.CoordinatesToCellName(c+1, 5)
|
||||
_ = f.SetCellValue(sheet, cell, h)
|
||||
}
|
||||
for i, b := range binds {
|
||||
bindRow := []any{
|
||||
b.Sn, b.FlowName, b.StationNo, b.MaterialCode, b.MaterialName, b.Spec,
|
||||
b.BindValue, b.BindMode, b.Operator, b.CreatedAt.Format("2006-01-02 15:04:05"),
|
||||
}
|
||||
for c, v := range bindRow {
|
||||
cell, _ := excelize.CoordinatesToCellName(c+1, 6+i)
|
||||
_ = f.SetCellValue(sheet, cell, v)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
w.Header().Set("Content-Type", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
|
||||
w.Header().Set("Content-Disposition", "attachment; filename*=UTF-8''"+url.PathEscape("不合格单.xlsx"))
|
||||
_, _ = f.WriteTo(w)
|
||||
|
||||
Reference in New Issue
Block a user