Parcourir la source

Merge branch 'zzd' of ssh://was.baoshi56.com:10022/var/git/bswas

 Conflicts:
	resources/views/maintenance/feature/menu.blade.php
LD il y a 5 ans
Parent
commit
f3530852ea

+ 10 - 1
app/Imports/ExpressImport.php

@@ -11,11 +11,20 @@ use Illuminate\Support\Collection;
 use Illuminate\Support\Facades\Cache;
 use Maatwebsite\Excel\Concerns\ToCollection;
 use Maatwebsite\Excel\Concerns\WithHeadingRow;
+use Maatwebsite\Excel\Concerns\WithMultipleSheets;
 use Maatwebsite\Excel\Imports\HeadingRowFormatter;
 
 HeadingRowFormatter::default('none');
-class ExpressImport implements ToCollection,WithHeadingRow
+class ExpressImport implements ToCollection,WithHeadingRow,WithMultipleSheets
 {
+
+    public function sheets(): array
+    {
+        return [
+            0 => $this,
+        ];
+    }
+
     protected $express;
     public function __construct(OwnerPriceExpress $express = null)
     {

+ 0 - 5
app/Imports/OrderTrackingImport.php

@@ -43,7 +43,6 @@ class OrderTrackingImport implements ToCollection
          * @var OrderPackage $package
          * @var Commodity $commodity
          */
-        $service = app('OrderTrackingService');
         $owner = Owner::query()->where('name','安桥主品')->first();
         $this->owner = $owner;
         $collection->shift();
@@ -84,10 +83,6 @@ class OrderTrackingImport implements ToCollection
     }
 
     public function getOrderPackageCommodities($items){
-        /**
-         * @var OrderService $orderService
-         */
-        $orderService = app('OrderService');
         $packages = $this->getPackage($items[1],$items);
         $packages = collect($packages);
         if(!$packages||$packages->isEmpty()){

+ 8 - 1
app/Imports/OwnerPriceDirectLogisticDetailImport.php

@@ -11,11 +11,18 @@ use Illuminate\Support\Collection;
 use Illuminate\Support\Facades\Cache;
 use Maatwebsite\Excel\Concerns\ToCollection;
 use Maatwebsite\Excel\Concerns\WithHeadingRow;
+use Maatwebsite\Excel\Concerns\WithMultipleSheets;
 use Maatwebsite\Excel\Imports\HeadingRowFormatter;
 
 HeadingRowFormatter::default('none');
-class OwnerPriceDirectLogisticDetailImport implements ToCollection,WithHeadingRow
+class OwnerPriceDirectLogisticDetailImport implements ToCollection,WithHeadingRow,WithMultipleSheets
 {
+    public function sheets(): array
+    {
+        return [
+            0 => $this,
+        ];
+    }
     protected $model;
 
     public function __construct($model)

+ 1 - 1
app/Imports/StoreCheckingReceiveImport.php

@@ -10,12 +10,12 @@ use Illuminate\Support\Collection;
 use Illuminate\Support\Facades\Cache;
 use Maatwebsite\Excel\Concerns\ToCollection;
 use Maatwebsite\Excel\Concerns\WithHeadingRow;
+use Maatwebsite\Excel\Concerns\WithMultipleSheets;
 use Maatwebsite\Excel\Imports\HeadingRowFormatter;
 
 HeadingRowFormatter::default('none');
 class StoreCheckingReceiveImport implements ToCollection,WithHeadingRow
 {
-
     /**
      * @param Collection $collection
      * @return bool

+ 1 - 0
app/OwnerPriceOperation.php

@@ -17,6 +17,7 @@ class OwnerPriceOperation extends Model
         "feature",          //特征
         "remark",           //备注
         "priority",         //优先级 值越大越高
+        "discount_count",   //减免值
     ];
     public static $features = null;
     public static $columnMapping = null;

+ 1 - 0
app/OwnerPriceOperationItem.php

@@ -18,6 +18,7 @@ class OwnerPriceOperationItem extends Model
         "unit_price",                       //单价
         "feature",                          //特征
         "priority",                         //优先级 值越大越高
+        "discount_price",                   //减免单价
     ];
     public $timestamps=false;
 

+ 1 - 30
app/Services/FeatureService.php

@@ -178,18 +178,6 @@ Class FeatureService
                         case "等于":
                             $logic = " = ";
                             break;
-                        case "大于":
-                            $logic = " > ";
-                            break;
-                        case "大于等于":
-                            $logic = " >= ";
-                            break;
-                        case "小于":
-                            $logic = " < ";
-                            break;
-                        case "小于等于":
-                            $logic = " <= ";
-                            break;
                     }
                     $str = $column.$logic."'".$describe."'";
                 }else $str = $features[$str]["type"].' '.$features[$str]["logic"].' '.$features[$str]["describe"];
@@ -242,7 +230,7 @@ Class FeatureService
                 $column = $features[$str]["type"];
                 $logic = $features[$str]["logic"];
                 $describe = $features[$str]["describe"];
-                if (($column == '商品名称' || $column == '订单数') && $isMultiMatching){
+                if ($column == '商品名称' && $isMultiMatching){
                     $packageColumn = $columnMapping["packages"] ?? "packages";
                     $packages = $matchObject[$packageColumn] ?? [];
                     $str = $this->multiMatching($packages,$logic,$describe,$columnMapping[$column] ?? '');
@@ -289,7 +277,6 @@ Class FeatureService
     {
         if(!$column)return 'false';
 
-        $sum = 0;
         foreach ($packages as $package){
             $value = $package[$column] ?? '';
             switch ($logic) {
@@ -302,24 +289,8 @@ Class FeatureService
                 case "等于":
                     if ($value == $describe)return 'true';
                     break;
-                default:
-                    $sum += $value;
             }
         }
-        switch ($logic) {
-            case "大于":
-                if ($sum > $describe) return 'true';
-                break;
-            case "大于等于":
-                if ($sum >= $describe) return 'true';
-                break;
-            case "小于":
-                if ($sum < $describe) return 'true';
-                break;
-            case "小于等于":
-                if ($sum <= $describe) return 'true';
-                break;
-        }
         return "false";
     }
 

+ 5 - 2
app/Services/OrderService.php

@@ -11,6 +11,7 @@ use App\OracleDOCOrderHeader;
 use App\Order;
 use App\OrderIssue;
 use App\Owner;
+use App\OwnerFeeDetail;
 use App\RejectedBill;
 use App\Services\common\BatchUpdateService;
 use App\Services\common\DataHandlerService;
@@ -600,7 +601,7 @@ class OrderService
         app("OrderCommodityService")->syncOrderCommodity($orderHeaders);
         app('OrderPackageService')->syncOrderPackage($orderHeaders);
         app("OrderPackageCommoditiesService")->syncOrderPackageCommodities($orderHeaders);
-//        $this->pushQueue($orderHeaders);
+        $this->pushQueue($orderHeaders);
         unset($orderHeaders);
     }
 
@@ -1008,6 +1009,8 @@ class OrderService
     {
         //检查订单对象
         if (!$order || $order->wms_status != "订单完成")return false;
+        if (OwnerFeeDetail::query()->where("outer_table_name","orders")->where("outer_id",$order->id)->first())return false;
+
         $order->loadMissing(["logistic","packages.commodities.commodity"]);
 
         /** @var OwnerPriceExpressService $service */
@@ -1060,7 +1063,7 @@ class OrderService
 
        if (app("OwnerFeeDetailService")->create([
             "owner_id"          => $order->owner_id,
-            "worked_at"         => $order->wms_edittime,
+            "worked_at"         => $order->wms_edittime ?? $order->updated_at,
             "type"              => "发货",
             "shop_id"           => $order->shop_id,
             "operation_bill"    => $order->code,

+ 1 - 0
app/Services/OwnerPriceOperationService.php

@@ -162,6 +162,7 @@ Class OwnerPriceOperationService
             return -7;
         }*/
         foreach ($rules as $rule){
+
             if (!$rule->items)continue;
             if ($rule->strategy == '特征'){
                 $bool = app("FeatureService")->matchFeature($rule->feature,$columnMapping,$matchObject);

+ 2 - 0
app/Services/StoreService.php

@@ -3,6 +3,7 @@
 namespace App\Services;
 
 use App\Order;
+use App\OwnerFeeDetail;
 use App\Services\common\BatchUpdateService;
 use App\Services\common\DataHandlerService;
 use App\Services\common\QueryService;
@@ -312,6 +313,7 @@ Class StoreService
     public function createInstantBill(Store $store): bool
     {
         if (!$store || $store->status != "已入库") return false;
+        if (OwnerFeeDetail::query()->where("outer_table_name","stores")->where("outer_id",$store->id)->first())return false;
         $store->loadMissing("storeItems");
 
         /** @var OwnerPriceOperationService $service */

+ 1 - 1
database/migrations/2021_01_25_104626_create_order_package_counting_records_table.php

@@ -14,7 +14,7 @@ class CreateOrderPackageCountingRecordsTable extends Migration
     public function up()
     {
         Schema::create('order_package_counting_records', function (Blueprint $table) {
-            $table->date("targeted_at")->index()->comment("统计日期");
+            $table->date("targeted_at")->primary()->comment("统计日期");
             $table->integer("un_weigh_count")->default(0)->comment("未称重数量");
             $table->integer("total_count")->default(0)->comment("总数");
         });

+ 12 - 4
database/migrations/2021_01_27_174543_add_column_owner_price_model_storage.php

@@ -17,8 +17,12 @@ class AddColumnOwnerPriceModelStorage extends Migration
         Schema::table('owner_storage_price_models', function (Blueprint $table) {
             $table->bigInteger("time_unit_id")->comment("计时单位");
         });
-        DB::statement("ALTER TABLE features MODIFY COLUMN type enum ('商品名称','订单类型','承运商','店铺类型','订单数') default null");
-        DB::statement("ALTER TABLE features MODIFY COLUMN logic enum ('包含','不包含','等于','大于','大于等于','小于','小于等于') default null");
+        Schema::table("owner_price_operations",function (Blueprint $table){
+            $table->integer("discount_count")->nullable()->comment("减免数");
+        });
+        Schema::table("owner_price_operation_items",function (Blueprint $table){
+            $table->decimal("discount_price")->nullable()->comment("减免单价");
+        });
     }
 
     /**
@@ -31,7 +35,11 @@ class AddColumnOwnerPriceModelStorage extends Migration
         Schema::table('owner_storage_price_models', function (Blueprint $table) {
             $table->dropColumn("time_unit_id");
         });
-        DB::statement("ALTER TABLE features MODIFY COLUMN type enum ('商品名称','订单类型','承运商','店铺类型') default null");
-        DB::statement("ALTER TABLE features MODIFY COLUMN logic enum ('包含','不包含','等于') default null");
+        Schema::table("owner_price_operations",function (Blueprint $table){
+            $table->dropColumn("discount_count");
+        });
+        Schema::table("owner_price_operation_items",function (Blueprint $table){
+            $table->dropColumn("discount_price");
+        });
     }
 }

+ 11 - 3
resources/views/customer/project/create.blade.php

@@ -176,8 +176,8 @@
                     discount_type:[
                         "无减免","按单减免","固定减免"
                     ],
-                    feature_type:['商品名称','订单类型','承运商','店铺类型'],
-                    logic : ['包含','不包含','等于'],
+                    feature_type:['商品名称','订单类型','承运商','店铺类型','订单数'],
+                    logic : ['包含','不包含','等于','大于','大于等于','小于','小于等于'],
                 },
                 poolMapping:{},//基础数据选择池的映射对象 供展示使用
                 selectedModel:{//已选定的计费模型
@@ -416,7 +416,6 @@
                         }
                         if (res.owner_price_expresses.length>0){
                             this._loadExpress();
-                            if (!this.pool.logistics)this._getLogistics();
                             res.owner_price_expresses.forEach((express,i)=>{
                                 express.logistics.forEach((logistic,j)=>{
                                     express.logistics[j] = logistic.id;
@@ -603,6 +602,11 @@
                         this.$forceUpdate();
                         return;
                     }
+                    if (this.model.operation.isDiscount && !this.model.operation.discount_count){
+                        this.errors["discount_price"] = ["满减值不存在"];
+                        this.$forceUpdate();
+                        return;
+                    }
                     if ((this.model.operation.operation_type === '出库' && this._verifyOperationItem(0)) || this._verifyOperationItem(1))return;
                     if (this.model.operation.items.length>2){
                         for (let i=2;i<this.model.operation.items.length;i++){
@@ -650,6 +654,10 @@
                 _verifyOperationItem(itemIndex){//验证作业费子项信息完整
                     let obj = this.model.operation.items[itemIndex];
                     let sign = false;
+                    if (this.model.operation.isDiscount && !obj.discount_price){
+                        this.errors['items.'+itemIndex+'.discount_price'] = ["满减单价不得为空"];
+                        sign = true;
+                    }
                     if (obj.strategy!=='起步' && !obj.amount){
                         this.errors['items.'+itemIndex+'.amount'] = ["数量不得为空"];
                         sign = true;

+ 34 - 1
resources/views/customer/project/part/_operation.blade.php

@@ -26,12 +26,21 @@
     </span>
 </div>
 <div class="row mt-3" v-if="model.operation.strategy == '特征'">
-    <label class="col-2">特征</label>
+    <label class="col-2">特征</label>
     <label class="col-8">
         <label v-if="model.operation.feature">@{{ model.operation.featureFormat }}</label><br>
         <button type="button" class="btn btn-dark col-2 ml-2" @click="showAddFeatureModal(-1,model.operation.feature)">调整特征</button>
     </label>
 </div>
+<div class="row mt-3" v-if="model.operation.operation_type == '出库'">
+    <label class="col-2" for="isDiscount">是否满减</label>
+    <input type="checkbox" id="isDiscount" class="col-2 rounded mt-1" v-model="model.operation.isDiscount">
+    <div class="col-8 row" v-if="model.operation.isDiscount">
+        <label class="col-3" for="discount">满减值</label>
+        <input id="discount" v-model="model.operation.discount_count"
+               class="form-control form-control-sm col-6" :class="errors.discount_count ? 'is-invalid' : ''" step="1" type="number" min="0">
+    </div>
+</div>
 <div class="row mt-3">
     {{--起步--}}
     <div class="card row text-white offset-1 col-9 bg-dark" v-if="model.operation.operation_type === '出库'">
@@ -76,6 +85,14 @@
                     <div class="row mt-0" v-if="errors['items.0.unit_price']">
                         <div class="offset-3"><small class="text-danger font-weight-bold ml-3">起步费为必填项</small></div>
                     </div>
+                    <div class="row mt-2" v-if="model.operation.isDiscount">
+                        <label class="col-3">满减起步费</label>
+                        <label class="col-5 mb-0"><input type="number" min="0" step="0.001" class="form-control" v-model="model.operation.items[0].discount_price"
+                                                         :class="errors['items.0.discount_price'] ? 'is-invalid' : ''"></label>
+                    </div>
+                    <div class="row mt-0" v-if="errors['items.0.discount_price']">
+                        <div class="offset-3"><small class="text-danger font-weight-bold ml-3">满减起步费为必填项</small></div>
+                    </div>
                 </div>
             </div>
         </div>
@@ -121,6 +138,14 @@
             <div class="row mt-0" v-if="errors['items.1.unit_price']">
                 <div class="offset-3"><small class="text-danger font-weight-bold ml-3">单价为必填项</small></div>
             </div>
+            <div class="row mt-2" v-if="model.operation.isDiscount">
+                <label class="col-3">满减单价</label>
+                <label class="col-5 mb-0"><input type="number" min="0" step="0.001" class="form-control" v-model="model.operation.items[1].discount_price"
+                                                 :class="errors['items.1.discount_price'] ? 'is-invalid' : ''"></label>
+            </div>
+            <div class="row mt-0" v-if="errors['items.1.discount_price']">
+                <div class="offset-3"><small class="text-danger font-weight-bold ml-3">满减单价为必填项</small></div>
+            </div>
         </div>
     </div>
 
@@ -164,6 +189,14 @@
             <div class="row mt-0" v-if="errors['items.'+i+'.unit_price']">
                 <div class="offset-3"><small class="text-danger font-weight-bold ml-3">单价为必填项</small></div>
             </div>
+            <div class="row mt-2" v-if="model.operation.isDiscount">
+                <label class="col-3">满减单价</label>
+                <label class="col-5 mb-0"><input type="number" min="0" step="0.001" class="form-control" v-model="item.discount_price"
+                                                 :class="errors['items.'+i+'.discount_price'] ? 'is-invalid' : ''"></label>
+            </div>
+            <div class="row mt-0" v-if="errors['items.'+i+'.discount_price']">
+                <div class="offset-3"><small class="text-danger font-weight-bold ml-3">满减单价为必填项</small></div>
+            </div>
             <div class="row mt-2">
                 <label class="col-3">特征:</label>
                 <label class="col-5">

+ 1 - 1
resources/views/customer/project/part/_storage.blade.php

@@ -46,7 +46,7 @@
         <label for="unit_id" class="col-5 offset-1 text-info">单位</label>
         <select id="unit_id" class="col-6 form-control"
                 :class="errors.unit_id ? 'is-invalid' : ''" v-model="model.storage.unit_id">
-            <option v-for="unit in pool.units" :value="unit.id">@{{ unit.name }}</option>
+            <option v-for="unit in pool.units" :value="unit.id" v-if="unit.name == 'm²' || unit.name == 'm³'">@{{ unit.name }}</option>
         </select>
         <span class="invalid-feedback mt-0 offset-2" role="alert" v-if="errors.unit_id">
             <strong>@{{ errors.unit_id[0] }}</strong>

+ 0 - 35
resources/views/maintenance/feature/create.blade.php

@@ -1,35 +0,0 @@
-@extends('layouts.app')
-@section('title')特征-录入@endsection
-
-@section('content')
-    <div id="nav2">
-        @component('maintenance.menu')@endcomponent
-        @component('maintenance.feature.menu')@endcomponent
-    </div>
-    <div class="container-fluid card">
-        <div class="card-body offset-3 mt-2">
-            <form method="post" action="{{url('')}}">
-                <div class="row">
-                    <label class="col-2" for="type">特征类型</label>
-                    <select class="form-control col-3" id="type" name="type">
-                        <option></option>
-                    </select>
-                </div>
-                <div class="row mt-3">
-                    <label class="col-2" for="logic">逻辑</label>
-                    <select class="form-control col-3" id="logic" name="logic">
-                        <option></option>
-                    </select>
-                </div>
-                <div class="row mt-3">
-                    <label class="col-2" for="describe">字段特征</label>
-                    <input class="form-control col-6" id="describe" name="describe">
-                </div>
-                <div class="row mt-3 offset-1">
-                    <button class="btn btn-success col-7">提交</button>
-                </div>
-            </form>
-        </div>
-    </div>
-@stop
-

+ 0 - 24
resources/views/maintenance/feature/index.blade.php

@@ -1,24 +0,0 @@
-@extends('layouts.app')
-@section('title')特征@endsection
-
-@section('content')
-    <div id="nav2">
-        @component('maintenance.menu')@endcomponent
-        @component('maintenance.feature.menu')@endcomponent
-    </div>
-    <div class="container-fluid card">
-        <div class="card-body mt-2">
-            <table class="table table-striped table-hover text-nowrap">
-                <tr>
-                    <th>ID</th>
-                    <th>类型</th>
-                    <th>逻辑</th>
-                    <th>特征</th>
-                    <th>创建时间</th>
-                    <th>操作</th>
-                </tr>
-            </table>
-        </div>
-    </div>
-@stop
-

+ 0 - 14
resources/views/maintenance/feature/menu.blade.php

@@ -1,14 +0,0 @@
-<div class="container-fluid nav3">
-    <div class="card menu-third" >
-        <ul class="nav nav-pills">
-            @can('特征-查询')
-            <li class="nav-item">
-                <a target="maintenance/feature" class="nav-link" href="{{url('maintenance/feature')}}" :class="{active:isActive('',3)}">查询</a>
-            </li> @endcan
-            @can('特征-录入')
-            <li class="nav-item">
-                <a target="maintenance/feature/create" class="nav-link" href="{{url('maintenance/feature/create')}}" :class="{active:isActive('create',3)}">录入</a>
-            </li> @endcan
-        </ul>
-    </div>
-</div>

+ 2 - 2
resources/views/maintenance/priceModel/operation/create.blade.php

@@ -172,8 +172,8 @@
                     {id:"{{$unit->id}}",name:"{{$unit->name}}"},
                     @endforeach
                 ],
-                type : ['商品名称','订单类型','承运商','店铺类型'],
-                logic : ['包含','不包含','等于'],
+                type : ['商品名称','订单类型','承运商','店铺类型','订单数'],
+                logic : ['包含','不包含','等于','大于','大于等于','小于','小于等于'],
                 features : [],
                 thisIndex : "",
                 errors:{!! $errors !!},

+ 2 - 2
resources/views/maintenance/priceModel/operation/index.blade.php

@@ -149,8 +149,8 @@
                 items : [],
                 updateDetailId : '',
                 units : null,
-                type : ['商品名称','订单类型','承运商','店铺类型'],
-                logic : ['包含','不包含','等于'],
+                type : ['商品名称','订单类型','承运商','店铺类型','订单数'],
+                logic : ['包含','不包含','等于','大于','大于等于','小于','小于等于'],
                 item : {
                     "strategy" : '特征',
                     "amount" : "",