haozi 5 лет назад
Родитель
Сommit
b909c5482a

+ 85 - 0
app/Http/Controllers/InventoryCompareController.php

@@ -0,0 +1,85 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use App\InventoryCompare;
+use Illuminate\Http\Request;
+
+class InventoryCompareController extends Controller
+{
+    /**
+     * Display a listing of the resource.
+     *
+     * @return \Illuminate\Http\Response
+     */
+    public function index()
+    {
+        //
+    }
+
+    /**
+     * Show the form for creating a new resource.
+     *
+     * @return \Illuminate\Http\Response
+     */
+    public function create()
+    {
+        //
+    }
+
+    /**
+     * Store a newly created resource in storage.
+     *
+     * @param  \Illuminate\Http\Request  $request
+     * @return \Illuminate\Http\Response
+     */
+    public function store(Request $request)
+    {
+        //
+    }
+
+    /**
+     * Display the specified resource.
+     *
+     * @param  \App\InventoryCompare  $inventoryCompare
+     * @return \Illuminate\Http\Response
+     */
+    public function show(InventoryCompare $inventoryCompare)
+    {
+        //
+    }
+
+    /**
+     * Show the form for editing the specified resource.
+     *
+     * @param  \App\InventoryCompare  $inventoryCompare
+     * @return \Illuminate\Http\Response
+     */
+    public function edit(InventoryCompare $inventoryCompare)
+    {
+        //
+    }
+
+    /**
+     * Update the specified resource in storage.
+     *
+     * @param  \Illuminate\Http\Request  $request
+     * @param  \App\InventoryCompare  $inventoryCompare
+     * @return \Illuminate\Http\Response
+     */
+    public function update(Request $request, InventoryCompare $inventoryCompare)
+    {
+        //
+    }
+
+    /**
+     * Remove the specified resource from storage.
+     *
+     * @param  \App\InventoryCompare  $inventoryCompare
+     * @return \Illuminate\Http\Response
+     */
+    public function destroy(InventoryCompare $inventoryCompare)
+    {
+        //
+    }
+}

+ 20 - 0
app/InventoryCompare.php

@@ -0,0 +1,20 @@
+<?php
+
+namespace App;
+
+use App\Traits\ModelTimeFormat;
+use Illuminate\Database\Eloquent\Model;
+
+class InventoryCompare extends Model
+{
+    use ModelTimeFormat;
+    protected $fillable=[
+        'owner_id','commodity_id', 'mission_code', 'source','custom_location','quality','amount_in_sys','amount_in_compare','differ','created_at',
+    ];
+    public function commodity(){
+        return $this->belongsTo('App\Commodity','commodity_id','id');
+    }
+    public function owner(){
+        return $this->belongsTo('App\Owner','owner_id','id');
+    }
+}

+ 29 - 0
database/migrations/2020_08_27_142630_add_authorities_inventory_compare.php

@@ -0,0 +1,29 @@
+<?php
+
+use App\Authority;
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class AddAuthoritiesInventoryCompare extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        (new Authority(['name'=>'库存管理-库存-库存对比','alias_name'=>'库存管理-库存-库存对比']))->save();
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Authority::where('name','库存管理-库存-库存对比')->delete();
+    }
+}

+ 41 - 0
database/migrations/2020_08_27_153512_create_inventory_compares_table.php

@@ -0,0 +1,41 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateInventoryComparesTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('inventory_compares', function (Blueprint $table) {
+            $table->bigIncrements('id');
+            $table->integer('owner_id')->index();
+            $table->integer('commodity_id')->index();
+            $table->string('mission_code')->nullable()->comment('任务号');
+            $table->enum('source',['客户表','无'])->default('客户表')->index()->comment('来源');
+            $table->string('custom_location')->nullable()->comment('属性仓');
+            $table->enum('quality',['正品','次品','未知'])->comment('质量状态');
+            $table->integer('amount_in_sys')->nullable()->comment('宝时库存');
+            $table->integer('amount_in_compare')->nullable()->comment('参考库存');
+            $table->integer('differ')->index()->default(0)->comment('差值');
+            $table->timestamp('created_at')->index()->nullable();
+            $table->timestamp('updated_at')->nullable();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('inventory_compares');
+    }
+}