|
|
@@ -8,11 +8,17 @@ class OrderDetail < ActiveRecord::Base
|
|
|
validates :order_no,:product_id,:nums, presence: true
|
|
|
validate :order_validation
|
|
|
after_create :import_orders
|
|
|
+ def before_import_save(record)
|
|
|
+ pd = Product.where("id = ?", record.product_id).first
|
|
|
+ pd = Product.where("id = ?", record.product_id).first
|
|
|
+ pd = Product.where("id = ?", record.product_id).first
|
|
|
+ pd = Product.where("id = ?", record.product_id).first
|
|
|
+ end
|
|
|
|
|
|
def import_orders
|
|
|
# 获取商品信息
|
|
|
pd = Product.where("id = ?", self.product_id).first
|
|
|
- #detail = OrderDetail.where("id = ?", self.id).first
|
|
|
+ detail = OrderDetail.where("id = ?", self.id).first
|
|
|
od = Order.where("order_id = ?", self.order_no).first
|
|
|
|
|
|
if !pd.blank? && !od.blank? && od.source=="sys"
|