diff --git a/service/process.go b/service/process.go index 3ecd575..bd3de0e 100644 --- a/service/process.go +++ b/service/process.go @@ -1422,16 +1422,17 @@ func (s *ProcessService) CreateSalesOrderWithDetail(req systemReq.SalesOrderCrea } // 防重检查:如果 AssociationOrderID 不为0,检查是否已存在相同订单 - if req.AssociationOrderID != 0 { - var existingOrder models.SalesOrder - if err := tx.Where("association_order_id = ? AND is_del = 0", req.AssociationOrderID).First(&existingOrder).Error; err == nil { - // 订单已存在,直接返回已有订单ID(幂等处理) - salesOrderID = existingOrder.ID - return nil - } else if err != gorm.ErrRecordNotFound { - return fmt.Errorf("查询重复订单失败: %v", err) - } - } + // 注释:幂等防重逻辑,已交由上游调用方保证唯一性,不再由此接口处理 + //if req.AssociationOrderID != 0 { + // var existingOrder models.SalesOrder + // if err := tx.Where("association_order_id = ? AND is_del = 0", req.AssociationOrderID).First(&existingOrder).Error; err == nil { + // // 订单已存在,直接返回已有订单ID(幂等处理) + // salesOrderID = existingOrder.ID + // return nil + // } else if err != gorm.ErrRecordNotFound { + // return fmt.Errorf("查询重复订单失败: %v", err) + // } + //} var invWarehouseID int64