chore: 批量完成项目多模块迭代优化
1. 废弃半成品库存表并统一库存主表 2. 修复列表排序与搜索大小写不敏感问题 3. 新增用户最近登录时间、工单BOM名称字段 4. 完善角色管理、工位选择器功能 5. 增加拧紧数据补录、成品自动回流WMS能力 6. 统一导出时间范围校验规则 7. 丰富物料/备料单筛选条件 8. 调整菜单与权限命名适配产品型号业务
This commit is contained in:
@@ -85,14 +85,40 @@ func (s *Service) evaluateTorqueCriterion(ctx context.Context, sn, stationNo str
|
||||
func (s *Service) ListTorqueRecords(ctx context.Context, sn, workOrderNo string, from, to time.Time) ([]*ent.TorqueRecord, error) {
|
||||
q := s.ctx.EntClient.TorqueRecord.Query()
|
||||
if sn != "" {
|
||||
q = q.Where(torquerecord.Sn(sn))
|
||||
// 大小写不敏感(2026-09-08 全项目搜索规范)
|
||||
q = q.Where(torquerecord.SnEqualFold(sn))
|
||||
}
|
||||
if workOrderNo != "" {
|
||||
q = q.Where(torquerecord.WorkOrderNo(workOrderNo))
|
||||
q = q.Where(torquerecord.WorkOrderNoEqualFold(workOrderNo))
|
||||
}
|
||||
return q.Order(ent.Desc(torquerecord.FieldTime)).Limit(500).All(ctx)
|
||||
}
|
||||
|
||||
// AddTorqueRecord 拧紧数据补录(管理端"拧紧查询-拧紧补录"tab 用,定位为设备漏传/手工修正)
|
||||
func (s *Service) AddTorqueRecord(ctx context.Context, sn, workOrderNo, screwNo, stationNo string, strain, angle float64, result, reason, operator string) error {
|
||||
if sn == "" || workOrderNo == "" {
|
||||
return errors.New("工单号与 SN 必填")
|
||||
}
|
||||
if reason == "" {
|
||||
return errors.New("补录原因必填(如:设备漏传/手工修正)")
|
||||
}
|
||||
if result == "" {
|
||||
result = "OK"
|
||||
}
|
||||
now := time.Now()
|
||||
_, err := s.ctx.EntClient.TorqueRecord.Create().
|
||||
SetSn(sn).SetWorkOrderNo(workOrderNo).SetScrewNo(screwNo).SetStationNo(stationNo).
|
||||
SetStrain(strain).SetTorque(strain).SetAngle(angle).
|
||||
SetResult(result).SetOperator(operator+"(补录)").SetTime(now).
|
||||
Save(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
s.ctx.EventLog.Write(ctx, "torque.manual.add", workOrderNo, operator, "torque_record", sn,
|
||||
"拧紧数据补录 "+workOrderNo+" "+sn, map[string]any{"reason": reason, "result": result, "screwNo": screwNo, "stationNo": stationNo})
|
||||
return nil
|
||||
}
|
||||
|
||||
// 计算一块工件某工序的扭矩步骤是否已报
|
||||
func (s *Service) hasWorkpieceProcess(ctx context.Context, sn string, processCode int) bool {
|
||||
cnt, _ := s.ctx.EntClient.WorkpieceProcess.Query().
|
||||
|
||||
Reference in New Issue
Block a user