feat: 全项目列表页操作列规范统一 + 问题.md 六条整改

- 操作列按6条标准统一(WMS 13页/MES 18页):fixed right、宽160超限折更多、一列一填充、危险操作link+二次确认置末、页面级新建移工具栏
- 修复MES物料档案启用报错:改走 POST /product-types/status 专用端点,不再被全字段必填校验拦截
- 附件归档清理由按年改为用户选月(精确到月,截止月最晚6个月前,默认当前月-6),前后端同步
- 序列号文案统一为「是=逐件录SN,否=按数量(不录SN)」,MES 下拉改单选框
- 入库货架/层/位置必填校验(InboundEntry 前端 + inbound.go 后端),杜绝有区域无货架的新脏数据
- 生产流程卡新增列表Tab(新接口 GET /process-card/list 分页),去掉筛选默认时间
- 清理遗留 assets_bak/public_bak 备份目录;更新 WMS/MES 前端构建产物(index.html)
This commit is contained in:
SunYF
2026-10-10 18:09:17 +08:00
parent f6a26256c5
commit 56d56648f9
224 changed files with 687 additions and 1874 deletions
+17 -8
View File
@@ -479,16 +479,25 @@ func diskStatusHandler(ctx *svc.ServiceContext) http.HandlerFunc {
func archiveAttachmentsHandler(ctx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req struct {
DryRun bool `json:"dryRun"`
DryRun bool `json:"dryRun"`
ArchiveBefore int64 `json:"archiveBefore"` // 归档截止月(精确到月):归档 createdAt <= ArchiveBefore 的附件,单位 unix 秒
}
_ = parseJSON(r, &req)
cfg := ctx.Config.Attachment
root := attRoot(ctx)
years := cfg.LocalRetentionYears
if years <= 0 {
years = 1
now := timeNow()
// 6 个月限制:归档截止月最晚只能选到 6 个月前,最近半年数据不可归档
sixAgo := now.AddDate(0, -6, 0)
sixAgoEnd := time.Date(sixAgo.Year(), sixAgo.Month()+1, 0, 23, 59, 59, 0, sixAgo.Location())
if req.ArchiveBefore <= 0 {
fail(w, http.StatusBadRequest, "请提供归档截止月")
return
}
cutYear := timeNow().Year() - years // 早于该年份的附件可归档
if req.ArchiveBefore > sixAgoEnd.Unix() {
fail(w, http.StatusBadRequest, "归档截止月需早于最近 6 个月,最近半年数据不可归档")
return
}
cutMonth := time.Unix(req.ArchiveBefore, 0)
recs, err := ctx.EntClient.Attachment.Query().
Where(attachment.ArchivedEQ(false), attachment.DeletedEQ(false)).
All(ctx0())
@@ -498,7 +507,7 @@ func archiveAttachmentsHandler(ctx *svc.ServiceContext) http.HandlerFunc {
}
moved, marked, failed := 0, 0, 0
for _, rec := range recs {
if int(time.Unix(rec.CreatedAt, 0).Year()) > cutYear-1 {
if rec.CreatedAt > req.ArchiveBefore { // 仅归档创建时间早于归档截止月(含当月)的附件
continue
}
if req.DryRun {
@@ -537,11 +546,11 @@ func archiveAttachmentsHandler(ctx *svc.ServiceContext) http.HandlerFunc {
}
if !req.DryRun {
ctx.EventLog.Write(ctx0(), "attachment.archive", r.Header.Get("X-Username"), "attachment", "",
fmt.Sprintf("附件归档:移动%d 标记%d 失败%d(早于 %d 年)", moved, marked, failed, cutYear),
fmt.Sprintf("附件归档:移动%d 标记%d 失败%d(截止月 %d-%02d)", moved, marked, failed, cutMonth.Year(), cutMonth.Month()),
map[string]any{"moved": moved, "marked": marked, "failed": failed})
}
ok(w, map[string]any{"moved": moved, "marked": marked, "failed": failed,
"cutYear": cutYear, "archiveDir": cfg.ArchiveDir, "dryRun": req.DryRun})
"archiveBefore": req.ArchiveBefore, "archiveDir": cfg.ArchiveDir, "dryRun": req.DryRun})
}
}
+4
View File
@@ -191,6 +191,10 @@ func createInboundHandler(ctx *svc.ServiceContext) http.HandlerFunc {
fail(w, http.StatusBadRequest, "区域必填,请先选择入库区域")
return
}
if req.ShelfNo == "" || req.LayerNo == "" || req.PositionNo == "" {
fail(w, http.StatusBadRequest, "货架/层/位置必填,不允许只填区域不填货架")
return
}
if req.InspectionNo == "" {
fail(w, http.StatusBadRequest, "检测单号必填,请填写入库检报告单号")
return