Procházet zdrojové kódy

增加订单导入功能

abiao před 4 roky
rodič
revize
1637a45f86
1 změnil soubory, kde provedl 7 přidání a 1 odebrání
  1. 7 1
      app/models/order_detail.rb

+ 7 - 1
app/models/order_detail.rb

@@ -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"