ソースを参照

订单管理-商品配置
盘收一体-BUG修复,页面修缮

Zhouzhendong 5 年 前
コミット
b065232958

+ 35 - 0
app/Http/Controllers/OrderCommodityAssignController.php

@@ -0,0 +1,35 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use App\Imports\UpdatePickZone;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Cache;
+use Illuminate\Support\Facades\Gate;
+use Maatwebsite\Excel\Facades\Excel;
+
+class OrderCommodityAssignController extends Controller
+{
+    public function index()
+    {
+        if(!Gate::allows('商品配置-查询')){ return redirect(url('denied'));  }
+        $assigns = app("OrderCommodityAssignService")->paginate();
+        return view("order.index.index",compact("assigns"));
+    }
+
+    public function import(Request $request)
+    {
+        if(!Gate::allows('商品配置-编辑')){ return ["success"=>false,"data"=>"无权操作!"];  }
+        $fileSuffix=$request->file('file')->getClientOriginalExtension();
+        if ($fileSuffix != 'xlsx' && $fileSuffix != 'xls' && $fileSuffix != 'csv')
+            return ['success'=>false,'data'=>'不支持该文件类型'];
+        ini_set('max_execution_time',2500);
+        ini_set('memory_limit','1526M');
+        $fileSuffix = ucwords($fileSuffix);
+
+        Excel::import(new UpdatePickZone(),$request->file('file')->path(),null,$fileSuffix);
+        if (Cache::has('commodityAssign'))return Cache::pull('commodityAssign');
+
+        return ["success"=>false,"data"=>"导入发生错误,数据无响应"];
+    }
+}

+ 7 - 1
app/Http/Controllers/StoreCheckingReceiveController.php

@@ -390,7 +390,7 @@ class StoreCheckingReceiveController extends Controller
         if(!Gate::allows('入库管理-盘收一体-盘收-编辑')){ return ['success'=>false, 'data'=>'无权操作!'];  }
         $id = $request->id ?? null;
         $counted_amount = $request->counted_amount ?? null;
-        if (!$id || !$counted_amount)return ['success'=>false, 'data'=>'参数传递错误!'];
+        if (!$id)return ['success'=>false, 'data'=>'参数传递错误!'];
         $item = app('StoreCheckingReceiveItemService')->find($id);
         if (!$item)return ['success'=>false, 'data'=>'被盘项不存在'];
         $params = ["counted_amount"=>$counted_amount];
@@ -435,4 +435,10 @@ class StoreCheckingReceiveController extends Controller
             app('LogService')->log(__METHOD__,"修改差异状态",json_encode($scr,JSON_UNESCAPED_UNICODE));
         }
     }
+
+    public function destroyItem(Request $request)
+    {
+        if (app("StoreCheckingReceiveItemService")->destroy($request->input("id")))return ["success"=>true];
+        return ["success"=>false,"data"=>"删除失败"];
+    }
 }

+ 1 - 9
app/Http/Controllers/TestController.php

@@ -99,15 +99,7 @@ class TestController extends Controller
     }
     public static function zzd()
     {
-        $year = (int)date('Y');
-        $month = (int)date('m');
-        if ($month == 1){
-            $year--;
-            $lastMonth = '12';
-        }else $lastMonth = ($month-1) < 10 ? "0".($month-1) : ($month-1);
-        $sql = "SELECT owner_id,SUM(work_fee)+SUM(logistic_fee) AS total FROM owner_fee_details WHERE created_at LIKE ? AND (type = '发货' AND logistic_fee IS NOT NULL AND work_fee IS NOT NULL) OR (type <> '发货' AND work_fee IS NOT NULL)  GROUP BY owner_id";
-        $billDetails = DB::select(DB::raw($sql),[$year."-".$lastMonth."%"]);
-dd($billDetails);
+        Cache::pull("authorities");
     }
 
     public function updateLaborRemark(){

+ 153 - 0
app/Imports/UpdatePickZone.php

@@ -0,0 +1,153 @@
+<?php
+
+namespace App\Imports;
+
+use App\OracleDOCOrderDetail;
+use App\Services\LogService;
+use Illuminate\Database\Eloquent\Builder;
+use Illuminate\Support\Collection;
+use Illuminate\Support\Facades\Auth;
+use Illuminate\Support\Facades\Cache;
+use Illuminate\Support\Facades\DB;
+use Maatwebsite\Excel\Concerns\ToCollection;
+use Maatwebsite\Excel\Concerns\WithHeadingRow;
+use Maatwebsite\Excel\Imports\HeadingRowFormatter;
+
+HeadingRowFormatter::default('none');
+class UpdatePickZone implements ToCollection,WithHeadingRow
+{
+    /**
+    * @param Collection $collection
+    * @return bool
+    * @throws
+    */
+    public function collection(Collection $collection)
+    {
+        $row = $collection->first();
+        $headers = ["订单编号","商品条码","数量","生产日期","失效日期"];
+        foreach ($headers as $header){
+            if (!isset($row[$header])){
+                Cache::put("commodityAssign",["success"=>false, "data"=>"表头不存在“".$header."”"],86400);
+                return false;
+            }
+        }
+
+        $errors = [];
+        $ids = [];
+        foreach ($collection as $index=>$item){
+            if ($item["生产日期"]) $item["生产日期"] = formatExcelDate($item["生产日期"]);
+            if ($item["失效日期"]) $item["失效日期"] = formatExcelDate($item["失效日期"]);
+
+            if (!$item["订单编号"]){
+                $errors[] = "第“" . ($index + 2) . "”行订单编号为空";
+                continue;
+            }
+            if (!$item["商品条码"]){
+                $errors[] = "第“" . ($index + 2) . "”行商品条码为空";
+                continue;
+            }
+            if (!$item["生产日期"] && !$item["失效日期"]){
+                $errors[] = "第“" . ($index + 2) . "”行不存在日期";
+                continue;
+            }
+            $detail = OracleDOCOrderDetail::query()->select("customerid","sku")
+                ->where("orderno",$item["订单编号"])
+                ->whereHas("sku",function ($query)use($item){
+                    /** @var Builder $query */
+                    $query->where("alternate_sku1",$item["商品条码"]);
+                })->first();
+            if (!$detail){
+                $errors[] = "第“" . ($index + 2) . "”行未知订单商品";
+                continue;
+            }
+            $sql = "select INV_LOT_LOC_ID.LOCATIONID,INV_LOT_LOC_ID.LOTNUM,BAS_LOCATION.PICKZONE,INV_LOT_LOC_ID.QTY from INV_LOT_ATT LEFT JOIN
+                        INV_LOT_LOC_ID ON INV_LOT_ATT.LOTNUM = INV_LOT_LOC_ID.LOTNUM LEFT JOIN BAS_LOCATION ON INV_LOT_LOC_ID.LOCATIONID = BAS_LOCATION.LOCATIONID
+                    where INV_LOT_ATT.LOTNUM in (select LOTNUM from INV_LOT_LOC_ID where CUSTOMERID = ? AND SKU = ? GROUP BY LOTNUM)";
+            $bindings = [$detail->customerid,$detail->sku];
+            if ($item["生产日期"]){
+                $sql .= " AND LOTATT01 = ?";
+                $bindings[] = $item["生产日期"];
+            }else $sql .= " AND LOTATT01 IS NULL";
+            if ($item["失效日期"]){
+                $sql .= " AND LOTATT02 = ?";
+                $bindings[] = $item["失效日期"];
+            }else $sql .= " AND LOTATT02 IS NULL";
+
+            $lot = DB::connection("oracle")->select(DB::raw($sql),$bindings);
+            if (!$lot){
+                $errors[] = "第“" . ($index + 2) . "”行未找到库位";
+                continue;
+            }
+            $result = null;
+            if (count($lot)>1){
+                $min = null;
+                $max = null;
+                $map = [];
+                foreach ($lot as $i => $l){
+                    $qty = (int)$l->quty;
+                    $map[$qty] = $i;
+                    if ($qty >= (int)$item["数量"] && $qty<=$max)$max = $qty;
+                    if ($qty < (int)$item["数量"] && $qty>=$min)$min = $qty;
+                }
+                if ($max !== null)$result = $lot[$map[$max]];
+                else $result = $lot[$map[$min]];
+            }
+            if (count($lot) == 1)$result = $lot[0];
+            if ($result){dd($result);
+                try{
+                    $detail->update([
+                        "lotnum" => $result->lotnum,
+                        "pickzone" => $result->pickzone,
+                        "kitreferenceno" => '0',
+                        "d_edi_09" => '0',
+                        "d_edi_10" => '0',
+                    ]);
+                    DB::connection("oracle")->commit();
+                    LogService::log(__METHOD__,"SUCCESS-指定效期分配修改库位",json_encode($detail)." | ".json_encode($result));
+                    $order = app("OrderService")->first(["code"=>$item["订单编号"]]);
+                    if (!$order){
+                        $errors[] = "第“" . ($index + 2) . "”行已成功修改FLUX库位但在本地未找到订单";
+                        continue;
+                    }
+                    $barcode = app("CommodityBarcodeService")->first(["code"=>$item["商品条码"]]);
+                    if (!$barcode){
+                        $errors[] = "第“" . ($index + 2) . "”行已成功修改FLUX库位但在本地未找到条码";
+                        continue;
+                    }
+                    $model = app("OrderCommodityAssignService")->create([
+                        "order_id"      =>  1,//$order->id,
+                        "commodity_id"  =>  1,//$barcode->commodity_id,
+                        "amount"        =>  $item["数量"],
+                        "produced_at"   =>  $item["生产日期"],
+                        "valid_at"      =>  $item["失效日期"],
+                        "batch_number"  =>  $result->lotnum,
+                        "location"      =>  $result->locationid,
+                        "region"        =>  $result->pickzone,
+                        "user_id"       =>  Auth::id(),
+                    ]);
+                    LogService::log(__METHOD__,"SUCCESS-生成配置记录",json_encode($model));
+                    $ids[] = $model->id;
+                }catch (\Exception $e){
+                    LogService::log(__METHOD__,"ERROR-指定效期分配修改库位",json_encode($detail)." | ".json_encode($result));
+                }
+            }else $errors[] = "第“" . ($index + 2) . "”行未找到可分配库位";
+        }
+        $assigns = app("OrderCommodityAssignService")->get(["id"=>$ids]);
+        $models = [];
+        foreach ($assigns as $assign){
+            $models[] = [
+                "orderNumber"   => $assign->order ? $assign->order->code : '',
+                "barcode"       => $assign->commodity ? $assign->commodity->barcode : '',
+                "amount"        => $assign->amount,
+                "producedAt"    => $assign->produced_at,
+                "validAt"       => $assign->valid_at,
+                "batchNumber"   => $assign->batch_number,
+                "location"      => $assign->location,
+                "region"        => $assign->region,
+                "createdAt"     => $assign->created_at,
+                "userName"      => $assign->user ? $assign->user->name : 'system',
+            ];
+        }
+        Cache::put("commodityAssign",["success"=>true,"data"=>$models,"errors"=>$errors]);
+    }
+}

+ 33 - 0
app/OrderCommodityAssign.php

@@ -0,0 +1,33 @@
+<?php
+
+namespace App;
+
+use Illuminate\Database\Eloquent\Model;
+
+class OrderCommodityAssign extends Model
+{
+    protected $fillable = [
+        "order_id",         //外键订单
+        "commodity_id",     //外键商品
+        "amount",           //数量  default 0
+        "produced_at",      //生产日期
+        "valid_at",         //失效日期
+        "batch_number",     //批次号
+        "location",         //库位
+        "region",           //库区
+        "user_id",          //操作人
+    ];
+
+    public function order()
+    {   //订单
+        return $this->hasOne(Order::class,"id","order_id");
+    }
+    public function commodity()
+    {   //商品
+        return $this->hasOne(Commodity::class,"id","commodity_id");
+    }
+    public function user()
+    {   //用户
+        return $this->hasOne(User::class,"id","user_id");
+    }
+}

+ 2 - 2
app/Providers/AppServiceProvider.php

@@ -2,7 +2,6 @@
 
 namespace App\Providers;
 
-use App\Customer;
 use App\Http\Controllers\Controller;
 use App\Services\AuthorityService;
 use App\Services\CacheService;
@@ -21,8 +20,8 @@ use App\Services\OracleBasCustomerService;
 use App\Services\OracleBasSkuService;
 use App\Services\OracleDocAsnDetailService;
 use App\Services\OracleDOCOrderHeaderService;
+use App\Services\OrderCommodityAssignService;
 use App\Services\OrderCountingRecordService;
-use App\Services\OracleDocAsnHerderService;
 use App\Services\OrderIssuePerformanceService;
 use App\Services\AllInventoryService;
 use App\Services\InventoryDailyLogService;
@@ -164,6 +163,7 @@ class AppServiceProvider extends ServiceProvider
         app()->singleton('OwnerPriceExpressService',OwnerPriceExpressService::class);
         app()->singleton('OwnerPriceLogisticService',OwnerPriceLogisticService::class);
         app()->singleton('OwnerPriceDirectLogisticService',OwnerPriceDirectLogisticService::class);
+        app()->singleton('OrderCommodityAssignService',OrderCommodityAssignService::class);
 
         $this->loadingOrderModuleService();
         $this->loadingBasedModuleService();

+ 31 - 0
app/Services/OrderCommodityAssignService.php

@@ -0,0 +1,31 @@
+<?php 
+
+namespace App\Services; 
+
+use App\OrderCommodityAssign;
+
+Class OrderCommodityAssignService
+{ 
+
+    public function paginate(array $params = null)
+    {
+        $query = OrderCommodityAssign::query()->with(["order","commodity.barcodes","user"])->orderByDesc("id");
+        return $query->paginate($params["paginate"] ?? 50);
+    }
+
+    public function create(array $params)
+    {
+        return OrderCommodityAssign::query()->create($params);
+    }
+
+    public function get(array $params)
+    {
+        $query = OrderCommodityAssign::query()->with(["order","commodity.barcodes","user"]);
+        foreach ($params as $column=>$param){
+            if (is_array($param))$query->whereIn($column,$param);
+            else $query->where($column,$param);
+        }
+        return $query->get();
+    }
+
+}

+ 11 - 0
app/Utils/helpers.php

@@ -0,0 +1,11 @@
+<?php
+
+use Carbon\Carbon;
+
+function formatExcelDate(int $timestamp)
+{
+    $diff = intval($timestamp);
+    $today=new Carbon('1900-01-01');
+    $day = $today->addDays($diff-2);
+    return $day->toDateString();
+}

+ 3 - 0
composer.json

@@ -57,6 +57,9 @@
         "classmap": [
             "database/seeds",
             "database/factories"
+        ],
+        "files": [
+            "app/Utils/helpers.php"
         ]
     },
     "autoload-dev": {

+ 52 - 0
database/migrations/2020_12_02_150054_create_order_commodity_assigns_table.php

@@ -0,0 +1,52 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateOrderCommodityAssignsTable extends Migration
+{
+
+    protected $authorities = [
+        "商品配置",
+        "商品配置-查询",
+        "商品配置-编辑",
+    ];
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        foreach ($this->authorities as $val) \App\Authority::query()->firstOrCreate(["name"=>$val,"alias_name"=>$val]);
+
+        Schema::create('order_commodity_assigns', function (Blueprint $table) {
+            $table->id();
+            $table->bigInteger("order_id")->index()->comment("外键订单");
+            $table->bigInteger("commodity_id")->comment("外键商品");
+            $table->integer("amount")->default(0)->comment("数量");
+            $table->date("produced_at")->nullable()->comment("生产日期");
+            $table->date("valid_at")->nullable()->comment("失效日期");
+            $table->string("batch_number")->index()->nullable()->comment("批次号");
+            $table->string("location")->index()->nullable()->comment("库位");
+            $table->string("region")->index()->nullable()->comment("库区");
+            $table->bigInteger("user_id")->index()->nullable()->comment("操作人");
+            $table->timestamps();
+            $table->index(["commodity_id","produced_at"]);
+            $table->index(["commodity_id","valid_at"]);
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('order_commodity_assigns');
+
+        foreach ($this->authorities as $val) \App\Authority::query()->where("name",$val)->where("alias_name",$val)->delete();
+    }
+}

+ 25 - 0
resources/views/order/index/_importModal.blade.php

@@ -0,0 +1,25 @@
+<div class="modal fade" tabindex="-1" role="dialog" id="importModal">
+    <div class="modal-dialog modal-dialog-centered modal-dialog-scrollable">
+        <div class="modal-content">
+            <div class="modal-body">
+                <div class="w-100 text-center mb-1" v-if="errors.length > 0">
+                    <button class="btn btn-sm btn-danger mb-1" @click="isShowError = true" v-if="!isShowError">@{{ errors.length }}条错误,点击展开</button>
+                    <button class="btn btn-sm btn-dark mb-1" @click="isShowError = false" v-else>收起错误展示</button>
+                    <div v-if="isShowError" class="container-fluid text-danger font-weight-bolder">
+                        <div class="row text-left">
+                            <div class="col-6" v-for="error in errors">@{{ error }}</div>
+                        </div>
+                    </div>
+                </div>
+                <div class="mt-5 mb-5">
+                    <input id="file" type="file" class="d-none" accept=".csv, .xlsx, .xls" @change="importAssign($event)"/>
+                    <label class="w-100 text-center small"><b>表头示例:</b><label class="text-primary">订单编号  商品条码  数量  生产日期  失效日期</label></label>
+                    <label class="w-100 row d-block ml-1"><input type="button" class="btn btn-dark col-6 offset-3" value="导入商品配置" @click="selectFile()"></label>
+                </div>
+            </div>
+            <div class="modal-footer">
+                <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
+            </div>
+        </div>
+    </div>
+</div>

+ 125 - 0
resources/views/order/index/index.blade.php

@@ -0,0 +1,125 @@
+@extends('layouts.app')
+@section('title')订单管理-商品配置@endsection
+
+@section('content')
+    @component('order.index.menu')@endcomponent
+<div class="container-fluid d-none" id="container">
+    @include("order.index._importModal")
+    <div class="card">
+        <div class="card-body">
+            <button class="btn  btn-outline-info mb-1" data-toggle="modal" data-target="#importModal">导入</button>
+            <table class="table table-striped table-hover" id="headerParent">
+                <tr id="header"></tr>
+                <tr v-for="(model,i) in models">
+                    <td>@{{ i+1 }}</td>
+                    <td>@{{ model.orderNumber }}</td>
+                    <td>@{{ model.barcode }}</td>
+                    <td>@{{ model.amount }}</td>
+                    <td>@{{ model.producedAt }}</td>
+                    <td>@{{ model.validAt }}</td>
+                    <td>@{{ model.batchNumber }}</td>
+                    <td>@{{ model.location }}</td>
+                    <td>@{{ model.region }}</td>
+                    <td>@{{ model.createdAt }}</td>
+                    <td>@{{ model.userName }}</td>
+                </tr>
+            </table>
+        </div>
+    </div>
+    {{$assigns->links()}}
+</div>
+@endsection
+
+@section('lastScript')
+<script type="text/javascript" src="{{mix('js/queryForm/header.js')}}"></script>
+<script>
+    new Vue({
+        el:"#container",
+        data:{
+            models:[
+                @foreach($assigns as $assign)
+                {
+                    orderNumber:"{{$assign->order ? $assign->order->code : ''}}",
+                    barcode:"{{$assign->commodity ? $assign->commodity->barcode : ''}}",
+                    amount:"{{$assign->amount}}",
+                    producedAt:"{{$assign->produced_at}}",
+                    validAt:"{{$assign->valid_at}}",
+                    batchNumber:"{{$assign->batch_number}}",
+                    location:"{{$assign->location}}",
+                    region:"{{$assign->region}}",
+                    createdAt:"{{$assign->created_at}}",
+                    userName:"{{$assign->user ? $assign->user->name : 'system'}}",
+                },
+                @endforeach
+            ],
+            isShowError : false,
+            errors:[],
+        },
+        mounted(){
+            $("#container").removeClass("d-none");
+            let column = [
+                {name:'index',value: '序号', neglect: true},
+                {name:'orderNumber',value: '订单编号'},
+                {name:'barcode',value: '商品条码'},
+                {name:'amount',value: '数量', neglect: true},
+                {name:'producedAt',value: '生产日期'},
+                {name:'validAt',value: '失效日期'},
+                {name:'batchNumber',value: '批次号'},
+                {name:'location',value: '库位'},
+                {name:'region',value: '库区'},
+                {name:'createdAt',value: '导入日期'},
+                {name:'userName',value: '操作人'},
+            ];
+            let header = new Header({
+                el: "#header",
+                column: column,
+                data: this.models,
+                restorationColumn: 'id',
+            });
+            header.init();
+        },
+        methods:{
+            selectFile(){
+                $("#file").click();
+            },
+            importAssign(e){
+                let file=e.target.files[0];
+                if (!file){
+                    tempTip.setDuration(3000);
+                    tempTip.setIndex(1099);
+                    tempTip.show("未选择文件");
+                    return;
+                }
+                let formData = new FormData();
+                formData.append("file",file);
+                window.tempTip.setIndex(1099);
+                window.tempTip.setDuration(9999);
+                window.tempTip.waitingTip("执行中,请耐心等候......");
+                axios.post('{{url('order/index/commodityAssign/import')}}',formData,{
+                    'Content-Type':'multipart/form-data'
+                })
+                    .then(res=>{
+                        if (res.data.success) {
+                            if (res.data.data.length>0) {
+                                this.models.unshift.apply(this.models,res.data.data);
+                                if (this.models.length>50) this.models.split(50);
+                            }
+                            this.errors = res.data.errors;
+                            tempTip.cancelWaitingTip();
+                            tempTip.setDuration(2000);
+                            tempTip.showSuccess("导入成功!");
+                            return;
+                        }
+                        tempTip.cancelWaitingTip();
+                        tempTip.setDuration(3000);
+                        tempTip.show(res.data.data);
+                    }).catch(err=> {
+                    tempTip.cancelWaitingTip();
+                    tempTip.setDuration(3000);
+                    tempTip.show("网络错误:"+err);
+                })
+            }
+        },
+    });
+</script>
+@endsection

+ 4 - 0
resources/views/order/index/menu.blade.php

@@ -8,6 +8,10 @@
                     <li class="nav-item">
                         <a class="nav-link" href="{{url('order/index/delivering')}}" :class="{active:isActive('delivering',3)}">查询</a>
                     </li> @endcan
+                @can('商品配置')
+                    <li class="nav-item">
+                        <a class="nav-link" href="{{url('order/index/commodityAssign')}}" :class="{active:isActive('commodityAssign',3)}">商品配置</a>
+                    </li> @endcan
             </ul>
         </div>
     </div>

+ 1 - 1
resources/views/order/menu.blade.php

@@ -4,7 +4,7 @@
         <ul class="nav nav-pills">
             @can('订单管理-查询')
             <li class="nav-item">
-                <a class="nav-link" href="{{url('order/index/delivering')}}" :class="{active:isActive('delivering',3)}">订单</a>
+                <a class="nav-link" href="{{url('order/index/delivering')}}" :class="{active:isActive('index',2)}">订单</a>
             </li>
             @endcan
             @can('订单管理-波次-查询')

+ 41 - 25
resources/views/store/checkingReceive/show.blade.php

@@ -109,12 +109,12 @@
                     <td>@{{ storeCheckingReceiveItem.imported_amount }}</td>
                     <td @click="showInput(storeCheckingReceiveItem.id)" v-if="is_show">
                         <div class="form-inline">
-                            <input  @blur="delFocus()" :id = "'counted_amount_'+storeCheckingReceiveItem.id" :value="storeCheckingReceiveItem.counted_amount"
-                                    class="form-control form-control-sm" type="text" :disabled="disabledItemId == storeCheckingReceiveItem.id ? false : true">
+                            <input @focus="showInput(storeCheckingReceiveItem.id)"  @blur="delFocus()" :id = "'counted_amount_'+storeCheckingReceiveItem.id" :value="storeCheckingReceiveItem.counted_amount"
+                                    class="form-control form-control-sm" type="number" :disabled="disabledItemId == storeCheckingReceiveItem.id ? false : true">
                             <button v-if="disabledItemId == storeCheckingReceiveItem.id" type="button" class="btn btn-sm btn-success ml-1"
                                 @click="updateCountedAmount(storeCheckingReceiveItem)">确定</button>
                             <button v-if="disabledItemId == storeCheckingReceiveItem.id" type="button" class="btn btn-sm btn-danger"
-                                @click="disabledItemId = ''">取消</button>
+                                @click.stop="disabledItemId = ''">取消</button>
                         </div>
                     </td>
                     <td v-if="!is_show">@{{ storeCheckingReceiveItem.counted_amount }}</td>
@@ -125,6 +125,7 @@
                     <td>@{{ storeCheckingReceiveItem.invalid_at }}</td>
                     <td>@{{ storeCheckingReceiveItem.batch_code }}</td>
                     <td>@{{ storeCheckingReceiveItem.unique_code }}</td>
+                    <td>@can('入库管理-盘收一体-盘收-编辑')<button @click="destroyItem(storeCheckingReceiveItem,i)" class="btn btn-sm btn-outline-danger">删除</button>@endcan</td>
                 </tr>
             </table>
         </div>
@@ -137,7 +138,7 @@
                         <label class="text-muted">序号:</label>@{{ i+1 }}
                     </div>
                     <div class="col-6">
-                        <span class="pull-right mr-1 text-muted font-weight-bold">···</span>
+                        <span class="pull-right mr-1 text-primary font-weight-bold small">点击展开</span>
                     </div>
                 </div>
                 <div class="row">
@@ -151,8 +152,8 @@
                     </div>
                 </div>
                 <div class="row">
-                    <div class="col-12">
-                        <label class="text-muted">名称:</label>@{{ storeCheckingReceiveItem.commodity_name }}
+                    <div class="col-12 form-inline">
+                        <label class="text-muted w-25">名称:</label><div class="w-75">@{{ storeCheckingReceiveItem.commodity_name }}</div>
                     </div>
                 </div>
                 <div class="row">
@@ -163,6 +164,14 @@
                         <label class="text-muted">实盘数:</label>@{{ storeCheckingReceiveItem.counted_amount }}
                     </div>
                 </div>
+                <div class="row">
+                    <div class="col-6">
+                        <label class="text-muted">导入差异:</label><small class="text-danger font-weight-bold">@{{ storeCheckingReceiveItem.imported_diff_amount }}</small>
+                    </div>
+                    <div class="col-6">
+                        <label class="text-muted">ASN差异:</label><small class="text-danger font-weight-bold">@{{ storeCheckingReceiveItem.asn_amount }}</small>
+                    </div>
+                </div>
                 <div v-if="signOpenId == storeCheckingReceiveItem.id">
                     <div class="row">
                         <div class="col-6">
@@ -172,22 +181,6 @@
                             <label class="text-muted">ASN数:</label>@{{ storeCheckingReceiveItem.asn_amount }}
                         </div>
                     </div>
-                    <div class="row">
-                        <div class="col-6">
-                            <label class="text-muted">导入差异:</label>@{{ storeCheckingReceiveItem.imported_diff_amount }}
-                        </div>
-                        <div class="col-6">
-                            <label class="text-muted">ASN差异:</label>@{{ storeCheckingReceiveItem.asn_amount }}
-                        </div>
-                    </div>
-                    <div class="row">
-                        <div class="col-6">
-                            <label class="text-muted">导入差异:</label>@{{ storeCheckingReceiveItem.imported_amount }}
-                        </div>
-                        <div class="col-6">
-                            <label class="text-muted">ASN差异:</label>@{{ storeCheckingReceiveItem.asn_diff_amount }}
-                        </div>
-                    </div>
                     <div class="row">
                         <div class="col-6">
                             <label class="text-muted">生产日期:</label>@{{ storeCheckingReceiveItem.produced_at }}
@@ -204,6 +197,11 @@
                             <label class="text-muted">批次号码:</label>@{{ storeCheckingReceiveItem.batch_code }}
                         </div>
                     </div>
+                    <div class="row">
+                        <div class="col-10 offset-1">
+                            @can('入库管理-盘收一体-盘收-编辑')<button @click.stop="destroyItem(storeCheckingReceiveItem,i)" class="btn btn-sm btn-outline-danger w-100">删除</button>@endcan
+                        </div>
+                    </div>
                 </div>
             </div>
         </div>
@@ -224,7 +222,7 @@
                 @foreach($storeCheckingReceive->storeCheckingReceiveItems as $storeCheckingReceiveItem)
                 {id:'{{$storeCheckingReceiveItem->id}}',bin_number:'{{$storeCheckingReceiveItem->bin_number}}',
                 commodity_name:"{{$storeCheckingReceiveItem->commodity ? $storeCheckingReceiveItem->commodity->name : ''}}",
-                commodity_barcodes:{!! $storeCheckingReceiveItem->commodity ? ($storeCheckingReceiveItem->commodity->barcodes ? $storeCheckingReceiveItem->commodity->barcodes : []) : [] !!},
+                commodity_barcodes:{!! $storeCheckingReceiveItem->commodity ? ($storeCheckingReceiveItem->commodity->barcodes ? $storeCheckingReceiveItem->commodity->barcodes : json_encode([])) : json_encode([]) !!},
                 imported_amount:'{{$storeCheckingReceiveItem->imported_amount}}',counted_amount:'{{$storeCheckingReceiveItem->counted_amount}}',
                 asn_amount:'{{$storeCheckingReceiveItem->asn_amount}}',imported_diff_amount:'{{$storeCheckingReceiveItem->imported_diff_amount}}',
                 asn_diff_amount:'{{$storeCheckingReceiveItem->asn_diff_amount}}',produced_at:'{{$storeCheckingReceiveItem->produced_at}}',
@@ -273,6 +271,7 @@
                 {name:'invalid_at',value: '有效期'},
                 {name:'batch_code',value: '批次号'},
                 {name:'unique_code',value: '唯一码'},
+                {name:'operating',value: '操作', neglect: true},
             ];
             let header = new Header({
                 el: "#header",
@@ -541,9 +540,7 @@
                     _this.inputting.bin_number = item.bin_number;
                     _this.commit(item, signIncreasing);
                 }else{
-                    //_this.status.binDisable=false;
                     _this.lastScannedBarcode = _this.inputting.barcode;
-                    //_this.inputting.bin_number = item.bin_number;
                     _this.focusOutDocument();
                     window.tempTip.setInputType('number');
                     window.tempTip.inputVal('该条码存在但无隔口号,请输入:', function (bin_number) {
@@ -699,6 +696,25 @@
                         window.tempTip.setDuration(3000);
                         window.tempTip.show("网络错误:"+err);
                     });
+            },
+            destroyItem(item,index){
+                let url = "{{url("store/checkingReceive/destroyItem")}}";
+                let param = {id:item.id};
+                window.tempTip.confirm("确定要删除商品“"+item.commodity_name+"”的盘点吗?",()=>{
+                    window.axios.post(url,param).then((res)=>{
+                        if (res.data.success){
+                            this.$delete(this.storeCheckingReceiveItems,index);
+                            window.tempTip.setDuration(2000);
+                            window.tempTip.showSuccess("删除成功");
+                            return;
+                        }
+                        window.tempTip.setDuration(3000);
+                        window.tempTip.show(res.data.data);
+                    }).catch(err=>{
+                        window.tempTip.setDuration(3000);
+                        window.tempTip.show("网络错误:"+err);
+                    })
+                });
             }
         },
     });

+ 6 - 0
routes/web.php

@@ -328,6 +328,7 @@ Route::group(['prefix'=>'store'],function(){
         Route::post('updateCountedAmount','StoreCheckingReceiveController@updateCountedAmount');
         Route::post('insertItem','StoreCheckingReceiveController@insertItem');
         Route::get('mission','StoreCheckingReceiveController@mission');
+        Route::post('destroyItem','StoreCheckingReceiveController@destroyItem');
     });
 });
 
@@ -498,7 +499,12 @@ Route::group(['prefix'=>'order'],function(){
     /** 主页 */
     Route::group(['prefix'=>'index'],function(){
         Route::get('delivering','OrderController@delivering');
+        Route::get('commodityAssign','OrderCommodityAssignController@index');
         Route::match(['get','post'],'export','OrderController@export');
+
+        Route::group(['prefix'=>'commodityAssign'],function(){
+            Route::post('import','OrderCommodityAssignController@import');
+        });
     });
     /** 创建 */
     Route::group(['prefix'=>'create'],function(){