Преглед изворни кода

add store records function

abiao пре 5 година
родитељ
комит
45fd4cc278

+ 3 - 3
app/models/express_company.rb

@@ -4,9 +4,9 @@ class ExpressCompany < ActiveRecord::Base
     validates :express_code,:express_company,presence:true
 
     rails_admin do
-        navigation_label '商品管理'
-        weight -250
-        parent Order
+        navigation_label '仓储物流管理'
+        weight -300
+        #parent Order
         nestable_tree({
             position_field: :position,
             max_depth: 2

+ 46 - 0
app/models/store_record.rb

@@ -0,0 +1,46 @@
+# encoding: utf-8
+class StoreRecord < ActiveRecord::Base
+  self.table_name = "store_records"
+  validates :version,:desc,presence: true
+
+  rails_admin do
+    navigation_label '仓储物流管理'
+    weight -300
+    list do
+      filters [:version,:state]
+      field :id
+      field :date_time
+      field :no
+      field :product_id
+      field :order_type
+      field :nums
+      field :operator
+      field :remark
+      field :created_at
+      # field :updated_at
+    end
+    show do
+      field :id
+      field :date_time
+      field :no
+      field :product_id
+      field :order_type
+      field :nums
+      field :operator
+      field :remark
+      field :created_at
+      field :created_at
+      field :updated_at
+    end
+    edit do
+      field :date_time
+      field :no
+      field :product_id
+      field :order_type
+      field :nums
+      field :operator
+      field :remark
+      field :created_at
+    end
+  end
+end

+ 3 - 3
app/models/update_order.rb

@@ -23,9 +23,9 @@ class UpdateOrder < ActiveRecord::Base
 
   end
   rails_admin do
-    navigation_label '商品管理'
-    weight -240
-    parent Order
+    navigation_label '仓储物流管理'
+    weight -300
+    #parent Order
     list do
       filters [:order_id,:express_order_no]
       # include_all_fields

+ 16 - 0
config/locales/models/store_record.yml

@@ -0,0 +1,16 @@
+zh-CN:
+  activerecord:
+    models:
+      store_record: 仓储物流管理
+    attributes:
+      store_record:
+        date_time: 日期
+        no: 单据号
+        product_id: 商品ID
+        product: 商品
+        order_type: 变动类别
+        nums: 变动数量
+        operator: 经手人
+        remark: 备注
+        created_at: 创建时间
+        updated_at: 更新时间

+ 29 - 0
db/migrate/20201218114699_create_store_records.rb

@@ -0,0 +1,29 @@
+# encoding:utf-8
+class CreateStoreRecords < ActiveRecord::Migration
+  def up
+    #库存变动表
+    create_table :store_records do |t|
+      #日期
+      t.column :date_time,:datetime
+      #单据号
+      t.column :no,:string
+      #商品ID
+      t.column :product_id, :integer,:null=>false, :default => 0
+      #变动类别
+      t.column :order_type, :integer,:null=>false, :default => 0
+      #数量
+      t.column :nums, :integer,:null=>false, :default => 0
+      #经手人
+      t.column :operator,:string
+      #备注
+      t.column :remark,:string
+      t.timestamps
+    end
+  end
+
+  def down
+    drop_table :store_records
+
+  end
+
+end