소스 검색

增加订单导入功能

abiao 4 년 전
부모
커밋
1637a45f86
1개의 변경된 파일7개의 추가작업 그리고 1개의 파일을 삭제
  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"