Просмотр исходного кода

库存管理-库存体积-增加毛重
需执行迁移

Zhouzhendong 5 лет назад
Родитель
Сommit
d11b2b49cb

+ 5 - 1
app/Console/Commands/InventoryDailyLoggingOwner.php

@@ -49,7 +49,7 @@ class InventoryDailyLoggingOwner extends Command
         if ($let == 0)return;
         //拼接SQL,SELECT仅取指定字段
         $sql = "SELECT INV_LOT.customerid,INV_LOT.sku,INV_LOT.qty,BAS_SKU.skulength,
-                BAS_SKU.skuwidth,BAS_SKU.skuhigh,BAS_SKU.cube,BAS_SKU.descr_c,BAS_SKU.alternate_sku1
+                BAS_SKU.skuwidth,BAS_SKU.skuhigh,BAS_SKU.cube,BAS_SKU.descr_c,BAS_SKU.alternate_sku1,BAS_SKU.grossweight
                 FROM INV_LOT
                 LEFT JOIN BAS_SKU ON INV_LOT.sku = BAS_SKU.sku AND INV_LOT.customerid = BAS_SKU.customerid
                 WHERE INV_LOT.customerid IN (";
@@ -80,9 +80,11 @@ class InventoryDailyLoggingOwner extends Command
                         'height'=>$invLot->skuhigh,
                         'volumn'=>$invLot->cube,
                         'code'=>$invLot->alternate_sku1,
+                        'weight' => $invLot->grossweight,
                     ],
                     'amount' => $invLot->qty,
                     'volumn_occupied' => 0,
+                    'gross_weight' => 0,
                 ];
             }
         }
@@ -113,12 +115,14 @@ class InventoryDailyLoggingOwner extends Command
             if ($commodity['code']) CommodityBarcode::query()->firstOrCreate(['commodity_id'=>$commodity_id,'code'=>$commodity['code']]);
             //计算总体积,商品体积×该单数量
             $volumn_occupied = $commodity['volumn']*$inventoryDailyLog["amount"];
+            $gross_weight = $commodity['weight']*$inventoryDailyLog["amount"];
             array_push($data,[
                 "owner_id"=>$commodity['owner_id'],
                 "created_at"=>date('Y-m-d H:i:s'),
                 "commodity_id"=>$commodity_id,
                 "amount"=>$inventoryDailyLog['amount'],
                 "volumn_occupied"=>$volumn_occupied,
+                "gross_weight"=>$gross_weight,
             ]);
         }
         DB::table('inventory_daily_logs')->insert($data);

+ 1 - 1
app/InventoryDailyLog.php

@@ -8,7 +8,7 @@ class InventoryDailyLog extends Model
 {
     public $timestamps=false;
     protected $fillable=[
-        'owner_id','created_at','commodity_id','amount','volumn_occupied'
+        'owner_id','created_at','commodity_id','amount','volumn_occupied','gross_weight'
     ];
 
     public function owner(){

+ 32 - 0
database/migrations/2020_09_25_141059_change_inventory_daily_logs_add_gross_weight.php

@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class ChangeInventoryDailyLogsAddGrossWeight extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('inventory_daily_logs', function (Blueprint $table) {
+            $table->decimal('gross_weight',11,3)->nullable()->comment('毛重');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('inventory_daily_logs', function (Blueprint $table) {
+            $table->dropColumn('gross_weight');
+        });
+    }
+}

+ 6 - 3
resources/views/inventory/statement/dailyLog.blade.php

@@ -14,10 +14,10 @@
                     </div>
                     <div class="modal-body container row" style="text-align:center">
                         <div class="col-2 mt-2" v-for="owner in owners">
-                            <div style="border: 1px solid #aac7ea;height: 80px;text-align: center;line-height: 80px;border-radius: 4px;cursor: pointer"
+                            <div class="tooltipTarget" style="border: 1px solid #aac7ea;height: 80px;text-align: center;line-height: 80px;border-radius: 4px;cursor: pointer;overflow: hidden"
                                 :style="[{'background': loggingOwners.includes(Number(owner.name)) ? '#00FF00' : ''},
                                     {'box-shadow' : seekOwners.includes(owner.name) ? '0px 0px 10px 5px rgba(0,0,0,0.9)' : ''}]"
-                            @click="addLoggingOwner( owner.name,owner.value )">@{{ owner.value }}</div>
+                            @click="addLoggingOwner( owner.name,owner.value )" :title="owner.value">@{{ owner.value }}</div>
                         </div>
                     </div>
                 </div>
@@ -71,6 +71,7 @@
                     <td>@{{ inventoryDailyLog.commodity_height }}</td>
                     <td>@{{ inventoryDailyLog.commodity_volumn }}</td>
                     <td>@{{ inventoryDailyLog.volumn_occupied }}</td>
+                    <td>@{{ inventoryDailyLog.gross_weight }}</td>
                 </tr>
             </table>
             {{$inventoryDailyLogs->appends($param)->links()}}
@@ -100,7 +101,8 @@
                         commodity_width:'{{$inventoryDailyLog->commodity ? $inventoryDailyLog->commodity->width : ''}}',
                         commodity_height:'{{$inventoryDailyLog->commodity ? $inventoryDailyLog->commodity->height : ''}}',
                         commodity_volumn:'{{$inventoryDailyLog->commodity ? $inventoryDailyLog->commodity->volumn : ''}}',
-                        volumn_occupied:'{{$inventoryDailyLog->volumn_occupied}}'},
+                        volumn_occupied:'{{$inventoryDailyLog->volumn_occupied}}',
+                        gross_weight:'{{$inventoryDailyLog->gross_weight}}'},
                     @endforeach
                 ],
                 owners : [
@@ -163,6 +165,7 @@
                     {name: 'commodity_height', value: '高', neglect: true},
                     {name: 'commodity_volumn', value: '体积', neglect: true},
                     {name: 'volumn_occupied', value: '总占用体积', neglect: true},
+                    {name: 'gross_weight', value: '总毛重', neglect: true},
                 ];
                 let _this = this;
                 setTimeout(function () {