浏览代码

多表切块

Zhouzhendong 3 年之前
父节点
当前提交
83c7f46e52

+ 2 - 2
app/Http/Controllers/OrderCommodityAssignController.php

@@ -2,7 +2,7 @@
 
 namespace App\Http\Controllers;
 
-use App\Imports\UpdatePickZone;
+use App\Imports\UpdatePickZoneSheets;
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\Cache;
 use Illuminate\Support\Facades\Gate;
@@ -27,7 +27,7 @@ class OrderCommodityAssignController extends Controller
         ini_set('memory_limit','1526M');
         $fileSuffix = ucwords($fileSuffix);
 
-        Excel::import(new UpdatePickZone(),$request->file('file')->path(),null,$fileSuffix);
+        Excel::import(new UpdatePickZoneSheets(),$request->file('file')->path(),null,$fileSuffix);
         if (Cache::has('commodityAssign'))return Cache::pull('commodityAssign');
 
         return ["success"=>false,"data"=>"导入发生错误,数据无响应"];

+ 4 - 0
app/Http/Controllers/TestController.php

@@ -55,6 +55,10 @@ class TestController extends Controller
     }
     public function test(Request $request)
     {
+        $list = DB::connection("aliyunMysql")->select("select * from equipment where category_id = 0 and type = 0 and parent_id is null");
+        foreach ($list as $item) {
+            $obj = json_decode($item->info);
+        }
     }
 }
 

+ 3 - 0
app/Imports/UpdatePickZone.php

@@ -25,6 +25,9 @@ class UpdatePickZone implements ToCollection,WithHeadingRow
     public function collection(Collection $collection)
     {
         $row = $collection->first();
+        if ($row) {
+            $row = $row->toArray();
+        }
         $headers = ["订单编号","商品条码","数量","生产日期","失效日期"];
         foreach ($headers as $header){
             if (!isset($row[$header])){

+ 16 - 0
app/Imports/UpdatePickZoneSheets.php

@@ -0,0 +1,16 @@
+<?php
+
+namespace App\Imports;
+
+use Maatwebsite\Excel\Concerns\WithMultipleSheets;
+
+class UpdatePickZoneSheets implements WithMultipleSheets
+{
+    public function sheets(): array
+    {
+        return [
+          0 => new UpdatePickZone(),
+        ];
+    }
+
+}

+ 1 - 0
app/Services/OwnerPriceOperationService.php

@@ -295,6 +295,7 @@ class OwnerPriceOperationService
      * @param string $type
      * @param int|null $typeMark
      *
+     *
      * @return double|array
      * 错误代码: -1:无匹配对象 -2:无计费模型 -3:未知单位 -4:sku为空 -5:货主未找到 -6:无箱规 -7:未匹配到计费模型
      *

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

@@ -57,7 +57,6 @@
         mounted(){
             $("#container").removeClass("d-none");
             let column = [
-                {name:'index',value: '序号', neglect: true},
                 {name:'orderNumber',value: '订单编号'},
                 {name:'barcode',value: '商品条码'},
                 {name:'amount',value: '数量', neglect: true},

+ 42 - 76
resources/views/process/index.blade.php

@@ -158,37 +158,35 @@
         <table class="table table-sm text-nowrap table-bordered td-min-width-80" id="table">
             <template>
             <tr v-for="(processOne,i) in processes" :class="[(count(i,processes)%2===0?'row-even':'' ),selectTr===i+1?'focusing':'']" :id="processOne.id?processOne.id:processes[i-1].id+'-2'"
-                :name="'process_table_'+count(i,processes)" @mouseover="changeStyle('process_table_'+count(i,processes),true)"
-                @mouseout="changeStyle('process_table_'+count(i,processes),false)"
-                @click="selectTr===i+1?(selectTr=0):selectTr=i+1">
+                :name="'process_table_'+count(i,processes)" @click="selectTr===i+1?(selectTr=0):selectTr=i+1">
                 <td v-if="processOne.id" :rowspan="processOne.is_multi_row?2:''">
                     <input class="checkItem" type="checkbox" :value="processOne.id">
                 </td>
                 <td v-if="processOne.id" class="text-muted" :rowspan="processOne.is_multi_row?2:''" >@{{ count(i,processes) }}</td>
                 <td v-if="processOne.id" style="min-width:200px;" :rowspan="processOne.is_multi_row?2:''">
                     @can("二次加工管理-审核")
-                    <button v-if="!processOne.openProcessHour && (processOne.status=='待审核' || processOne.status=='已驳回')"  @mouseenter="processOne.buttonTexts.审核='审核'" @mouseleave="processOne.buttonTexts.审核='审'" class="btn btn-sm btn-outline-success" @click="audit(processOne)"><span>@{{ processOne.buttonTexts.审核 }}</span></button>@endcan
+                    <button v-if="!processOne.openProcessHour && (processOne.status=='待审核' || processOne.status=='已驳回')" class="btn btn-sm btn-outline-success" @click="audit(processOne)"><span>审核</span></button>@endcan
                     @can("二次加工管理-回滚")
-                    <button v-if="!processOne.openProcessHour && processOne.status!='交接完成' && processOne.status!='待审核'" class="btn btn-sm btn-outline-dark" style="opacity: 0.65" @click="rollback(processOne.id)" @mouseenter="processOne.buttonTexts.回滚='回滚'" @mouseleave="processOne.buttonTexts.回滚='回'">@{{ processOne.buttonTexts.回滚 }}</button>@endcan
+                    <button v-if="!processOne.openProcessHour && processOne.status!='交接完成' && processOne.status!='待审核'" class="btn btn-sm btn-outline-dark" style="opacity: 0.65" @click="rollback(processOne.id)">回滚</button>@endcan
                     @can("二次加工管理-质量验收")
-                    <button v-if="!processOne.openProcessHour && processOne.status=='待验收'" class="btn btn-sm btn-outline-success" @click="checkAndAccept(processOne)" @mouseenter="processOne.buttonTexts.质量验收='质量验收'" @mouseleave="processOne.buttonTexts.质量验收='验'">@{{processOne.buttonTexts.质量验收}}</button>@endcan
+                    <button v-if="!processOne.openProcessHour && processOne.status=='待验收'" class="btn btn-sm btn-outline-success" @click="checkAndAccept(processOne)">质量验收</button>@endcan
                     @can("二次加工管理-接单与驳回")
-                    <button v-if="!processOne.openProcessHour && processOne.status=='待接单'" @click="processReject(processOne.id)" class="btn btn-sm btn-outline-dark" @mouseenter="processOne.buttonTexts.驳回='驳回'" @mouseleave="processOne.buttonTexts.驳回='驳'">@{{processOne.buttonTexts.驳回}}</button>
-                    <button v-if="(!processOne.openProcessHour && processOne.status=='待接单') && ((!processOne.designate_id) || processOne.designate_id==userId)"  @click="processReceive(processOne.id,i)" class="btn btn-sm btn-outline-primary" @mouseenter="processOne.buttonTexts.接单='接单'" @mouseleave="processOne.buttonTexts.接单='接'">@{{processOne.buttonTexts.接单}}</button>@endcan
+                    <button v-if="!processOne.openProcessHour && processOne.status=='待接单'" @click="processReject(processOne.id)" class="btn btn-sm btn-outline-dark">驳回</button>
+                    <button v-if="(!processOne.openProcessHour && processOne.status=='待接单') && ((!processOne.designate_id) || processOne.designate_id==userId)"  @click="processReceive(processOne.id,i)" class="btn btn-sm btn-outline-primary">接单</button>@endcan
                     @can("二次加工管理-登记工时")<button :style="[{opacity:processOne.status=='交接完成'?'0.7':''},{transform:processOne.status=='交接完成'?'scale(0.85)':''}]" v-if="(processOne.status!='待审核' && processOne.status!='已驳回' && processOne.status!='待接单') && !processOne.openProcessHour"
-                            class="btn btn-sm btn-outline-info" @click="openProcessHour(processOne);processOne.openProcessHour=true;processOne.detailFolding=false" @mouseenter="processOne.buttonTexts.登记工时='登记工时'" @mouseleave="processOne.buttonTexts.登记工时='登'">@{{processOne.buttonTexts.登记工时}}</button>
+                            class="btn btn-sm btn-outline-info" @click="openProcessHour(processOne);processOne.openProcessHour=true;processOne.detailFolding=false">登记工时</button>
                     <button v-if="processOne.openProcessHour" @click="closeProcessHour(processOne.id);processOne.openProcessHour=false" class="btn btn-sm btn-dark">收起登记工时</button>
-                    <button v-if="!processOne.openProcessHour && processOne.status=='加工中'" @click="processAccomplish(processOne)" class="btn btn-sm btn-outline-success" style="opacity: 0.7" @mouseenter="processOne.buttonTexts.完成='完成'" @mouseleave="processOne.buttonTexts.完成='完'">@{{processOne.buttonTexts.完成}}</button>@endcan
-                    @can("二次加工管理-交接完成")<button v-if="!processOne.openProcessHour && processOne.status=='待交接'" @click="accomplish(processOne)" class="btn btn-sm btn-outline-success" @mouseenter="processOne.buttonTexts.交接完成='交接完成'" @mouseleave="processOne.buttonTexts.交接完成='交'">@{{processOne.buttonTexts.交接完成}}</button>@endcan
+                    <button v-if="!processOne.openProcessHour && processOne.status=='加工中'" @click="processAccomplish(processOne)" class="btn btn-sm btn-outline-success" style="opacity: 0.7">完成</button>@endcan
+                    @can("二次加工管理-交接完成")<button v-if="!processOne.openProcessHour && processOne.status=='待交接'" @click="accomplish(processOne)" class="btn btn-sm btn-outline-success" >交接完成</button>@endcan
                     @can("二次加工管理-编辑")
-                        <button v-if="!processOne.openProcessHour && (processOne.status=='待审核' ||processOne.status=='待接单' || processOne.status=='已驳回' || processOne.status=='加工中' || processOne.status=='待加工')" @click="processEdit(processOne.id)" class="btn btn-sm btn-outline-info" @mouseenter="processOne.buttonTexts.编辑='编辑'"
-                                @mouseleave="processOne.buttonTexts.编辑='编'" style="opacity: 0.6">@{{processOne.buttonTexts.编辑}}</button>
+                        <button v-if="!processOne.openProcessHour && (processOne.status=='待审核' ||processOne.status=='待接单' || processOne.status=='已驳回' || processOne.status=='加工中' || processOne.status=='待加工')" @click="processEdit(processOne.id)" class="btn btn-sm btn-outline-info"
+                                 style="opacity: 0.6">编辑</button>
                     @endcan
                 </td>
                 <td v-if="processOne.id" :rowspan="processOne.is_multi_row?2:''"
                     :class="processOne.status==='已驳回' ? 'text-danger' : (processOne.status==='交接完成' ? 'text-success font-weight-bold' : 'text-muted')">@{{ processOne.status }}</td>
                 <td v-if="processOne.id" class="text-muted" :rowspan="processOne.is_multi_row?2:''">
-                    <button style="transform: scale(0.85);opacity: 0.8;" class="btn btn-sm btn-info" @click="show(processOne.id)" @mouseenter="processOne.buttonTexts.查看单据='查看单据'" @mouseleave="processOne.buttonTexts.查看单据='查'">@{{ processOne.buttonTexts.查看单据 }}</button>
+                    <button style="transform: scale(0.85);opacity: 0.8;" class="btn btn-sm btn-info" @click="show(processOne.id)">查看单据</button>
                     @{{ processOne.code }}
                 </td>
                 <td v-if="processOne.id" class="text-muted" :rowspan="processOne.is_multi_row?2:''">
@@ -214,7 +212,7 @@
                 <td v-if="processOne.id" :rowspan="processOne.is_multi_row?2:''" class="font-weight-bold text-danger">@{{ processOne.process_method_name }}</td>
                 <td v-if="processOne.id" :rowspan="processOne.is_multi_row?2:''">@{{ processOne.amount }}</td>
                 <td v-if="processOne.id" :rowspan="processOne.is_multi_row?2:''">
-                    <div class="" v-if="processOne.tutorials" {{--style="width: 200px;overflow:auto;"--}}>
+                    <div class="" v-if="processOne.tutorials">
                         <div v-if=" processOne.tutorials.length>0">
                         <u v-if="!processOne.detailFolding" @click="showTutorial(processOne.tutorials[0].id)" class="text-info" style="cursor:pointer;">@{{processOne.tutorials[0].name}}</u>
                             <button href="javascript:;" class="btn btn-sm btn-outline-primary" @click="processOne.detailFolding=true;processOne.openProcessHour=false;closeProcessHour(processOne.id)" v-if="!processOne.detailFolding"><a v-if="processOne.tutorials.length>1">@{{processOne.tutorials.length}}条,展开</a><a v-else>编辑</a></button>
@@ -288,40 +286,16 @@
                         </div>
                         <div class="row">
                             <div class="text-center col-12 cursor-pointer">
-                                <b v-if="processUnfold[processOne.code+processOne.id]=='原料单'" @click="close(processOne.code,processOne.id)">点击关闭原料单</b>
-                                <b v-if="processUnfold[processOne.code+processOne.id]=='成品单'" @click="close(processOne.code,processOne.id)">点击关闭成品单</b></div>
+                                <b v-if="processUnfold[processOne.code+processOne.id]==='原料单'" @click="close(processOne.code,processOne.id)">点击关闭原料单</b>
+                                <b v-if="processUnfold[processOne.code+processOne.id]==='成品单'" @click="close(processOne.code,processOne.id)">点击关闭成品单</b></div>
                         </div>
                     </div>
-                    {{--<table class="table table-sm table-striped" style="margin:0;padding:0;" v-if="processUnfold[processOne.code+processOne.id] || processOne.processesContents.length==1 ||
-                    (processOne.is_multi_row &&  (processOne.processesContents.length)-(processFullSum[processOne.code])==1) || (!processOne.id &&  processFullSum[processOne.code]==1)">
-                        <tr v-for="processesContent in processOne.processesContents"
-                            v-if="processOne.is_multi_row || !processOne.id ? !processOne.id  ? processesContent.type=='成品单' :processesContent.type=='原料单' : true">
-                            <td style="width: 190px" class="text-muted" :class="processesContent.type=='原料单'?'td-warm':'td-cool'">@{{ processesContent.bill_type }} <span style="opacity: 0.75">(@{{ processesContent.type }})</span></td>
-                            <td style="width: 210px" class="text-muted" :class="processesContent.type=='原料单'?'td-warm':'td-cool'">@{{ processesContent.wms_code }}</td>
-                            <td style="width: 100px" class="text-muted" :class="processesContent.type=='原料单'?'td-warm':'td-cool'">@{{ processesContent.amount }}</td>
-                            <td style="width: 180px" class="text-muted" :class="processesContent.type=='原料单'?'td-warm':'td-cool'">
-                                <ul class="p-0 m-0 list-unstyled list-inline" v-if="processesContent.commodity && !processesContent.sign_commodity_barcode_mark">
-                                    <li v-for="barcode in processesContent.commodity.barcodes"><small>@{{ barcode.code }}</small></li>
-                                </ul>
-                                <span v-if="processesContent.sign_commodity_barcode_mark">@{{ processesContent.sign_commodity_barcode_mark }}</span>
-                            </td>
-                            <td :title="processesContent.sign_commodity_name_mark?processesContent.sign_commodity_name_mark:processesContent.commodity_name" class="text-muted tooltipTarget" :class="processesContent.type=='原料单'?'td-warm':'td-cool'">
-                                <div style="width: 180px;white-space: normal" :class="processesContent.bill_type=='原料单'?'td-warm':'td-cool'">@{{ processesContent.sign_commodity_name_mark?processesContent.sign_commodity_name_mark:processesContent.commodity_name }}</div></td>
-                        </tr>
-                        <tr v-if="processUnfold[processOne.code+processOne.id]">
-                           <td colspan="5">
-                               <div class="text-center">
-                                   <b v-if="processUnfold[processOne.code+processOne.id]=='原料单'" style="cursor:pointer;" @click="close(processOne.code,processOne.id)">点击关闭原料单</b>
-                                   <b v-if="processUnfold[processOne.code+processOne.id]=='成品单'" style="cursor:pointer;" @click="close(processOne.code,processOne.id)">点击关闭成品单</b></div>
-                           </td>
-                        </tr>
-                    </table>--}}
-                    <div v-else :style="[{background: (!processOne.id || processOne.is_multi_row)  ? (!processOne.id) ? '#e8eef6' :'rgb(246, 238, 232)' : (processOne.processesContents.length>0 ? ((processOne.processesContents[0].type=='成品单') ? '#e8eef6' : 'rgb(246, 238, 232)') :'')}
-                    ,{'-webkit-transform':'scale('+(1/Math.ceil(arrayFilter(processOne.processesContents,processOne).length/2))+')'},{height: (35*Math.ceil(arrayFilter(processOne.processesContents,processOne).length/2))+'px'}
-                    ,{width: (100*Math.ceil(arrayFilter(processOne.processesContents,processOne).length/2))+'%'},{'margin-left': (-100*((Math.ceil(arrayFilter(processOne.processesContents,processOne).length/2))-1)/2)+'%'}
-                    ,{'margin-top': (-35*((Math.ceil(arrayFilter(processOne.processesContents,processOne).length/2))-1)/2)+'px'},{'margin-bottom': (-35*((Math.ceil(arrayFilter(processOne.processesContents,processOne).length/2))-1)/2)+'px'}]">
-                        <div v-for="(processesContent,i) in arrayFilter(processOne.processesContents,processOne)"  class=" row  p-1" style="float: left;margin-right: 10px;-webkit-transform-origin: 0" :style="[{opacity:1/0.7},
-                        {'margin-left': arrayFilter(processOne.processesContents,processOne).length >3 ? (1*parseInt(arrayFilter(processOne.processesContents,processOne).length/3))+'px' : '0px'}]">
+                    <div v-else :style="[{background: (!processOne.id || processOne.is_multi_row)  ? (!processOne.id) ? '#e8eef6' :'rgb(246, 238, 232)' : (processOne.processesContents.length>0 ? ((processOne.processesContents[0].type==='成品单') ? '#e8eef6' : 'rgb(246, 238, 232)') :'')}
+                    ,{'-webkit-transform':'scale('+(1/Math.ceil(processOne.array.length/2))+')'},{height: (35*Math.ceil(processOne.array.length/2))+'px'}
+                    ,{width: (100*Math.ceil(processOne.array.length/2))+'%'},{'margin-left': (-100*((Math.ceil(processOne.array.length/2))-1)/2)+'%'}
+                    ,{'margin-top': (-35*((Math.ceil(processOne.array.length/2))-1)/2)+'px'},{'margin-bottom': (-35*((Math.ceil(processOne.array.length/2))-1)/2)+'px'}]">
+                        <div v-for="(processesContent,i) in processOne.array"  class=" row  p-1" style="float: left;margin-right: 10px;-webkit-transform-origin: 0" :style="[{opacity:1/0.7},
+                        {'margin-left': processOne.array.length >3 ? (parseInt(processOne.array.length/3))+'px' : '0px'}]">
                             <span>@{{ processesContent.bill_type }}</span>&nbsp;&nbsp;
                             <span>@{{ processesContent.wms_code }}</span>&nbsp;&nbsp;
                             <span>@{{ processesContent.amount }}</span>&nbsp;&nbsp;
@@ -478,7 +452,7 @@
     <script type="text/javascript" src="{{mix('js/queryForm/queryForm.js')}}"></script>
     <script type="text/javascript" src="{{mix('js/queryForm/header.js')}}"></script>{{--新版2--}}
     <script>
-        let vue = new Vue({
+        new Vue({
             el:"#process",
             data:{
                 participantInputting:{},
@@ -491,21 +465,21 @@
                         balance_remark:'{{preg_replace("/\s/",' ',$processOne->balance_remark)}}',
                         designate_id:"{{$processOne->designate_id}}",
                         detailFolding:false,openProcessHour:false,is_multi_row:false,is_verifier_show:false,is_update_unit_price:false,
-                        buttonTexts:{'审核':'审','回滚':'回','编辑':'编','接单':'接','驳回':'驳','质量验收':'验','完成':'完','交接完成':'交','查看单据':'查','登记工时':'登'},
+                        array: []
                     },
                     @endforeach
                 ],
                 userId:"{{\Illuminate\Support\Facades\Auth::id()}}",
                 processesList:[],
                 owners:[
-                        @foreach($owners as $owner)
+                   @foreach($owners as $owner)
                     { name:'{{$owner->id}}',value:'{{$owner->name}}'},
-                    @endforeach
+                   @endforeach
                 ],
                 status:[
                     {name:'待审核',value:'待审核'},{name:'待接单',value:'待接单'},{name:'待加工',value:'待加工'},
                     {name:'已驳回',value:'已驳回'},{name:'加工中',value:'加工中'},{name:'待验收',value:'待验收'},
-                    {name:'交接完成',value:'交接完成'},
+                    {name:'交接完成',value:'交接完成'}
                 ],
                 errors:{},
                 processDailies:[],
@@ -588,54 +562,55 @@
                     isRestorationColumnAsc :true,
                     isForbidDrag:true,
                 }).init();
+                for (let i = 0; i < this.processes.length; i++) {
+                    this.processes[i].array = this.arrayFilter(processes[i]);
+                }
             },
             methods: {
-                arrayFilter: function (processesContents, process) {
-                    if (!process.is_multi_row && process.id) return processesContents;
+                arrayFilter: function (process) {
+                    if (!process.is_multi_row && process.id) return process.processesContents;
                     let array = [];
                     let type = '成品单';
                     if (process.id) type = '原料单';
-                    processesContents.forEach(function (processesContent) {
+                    process.processesContents.forEach(function (processesContent) {
                         if (processesContent.type === type) array.push(processesContent);
                     });
                     return array;
                 },
                 //重组数据
                 resetProcessData: function () {
-                    let _this = this;
                     let indexs = [];
                     let count = 0;
                     for (let i = 0; i < this.processes.length; i++) {
                         let process = this.processes[i];
-                        _this.$set(_this.signs,process.code,[]);
-                        process.signs.forEach(function (sign) {
-                            _this.$set(_this.signs[process.code],sign.mark,true);
+                        this.$set(this.signs,process.code,[]);
+                        process.signs.forEach(sign => {
+                            this.$set(this.signs[process.code],sign.mark,true);
                         });
                         process.serial_number = count;
-                        process.processesContents.every(function (processesContent) {
-                            if (processesContent.type === '成品单') _this.$set(_this.processFullSum, process.code, _this.processFullSum[process.code] ? _this.processFullSum[process.code] + 1 : 1);
+                        process.processesContents.every(processesContent => {
+                            if (processesContent.type === '成品单') this.$set(this.processFullSum, process.code, this.processFullSum[process.code] ? this.processFullSum[process.code] + 1 : 1);
                             return true;
                         });
-                        if (_this.processFullSum[process.code] && _this.processFullSum[process.code] !== 0 && _this.processFullSum[process.code] !== process.processesContents.length) {
+                        if (this.processFullSum[process.code] && this.processFullSum[process.code] !== 0 && this.processFullSum[process.code] !== process.processesContents.length) {
                             indexs.unshift(i);
                             count++;
                             process.is_multi_row = true;
                         }
                         count++;
                     }
-                    indexs.forEach(function (index) {
-                        let processTemp = Object.assign({}, _this.processes[index]);
+                    indexs.forEach(index => {
+                        let processTemp = Object.assign({}, this.processes[index]);
                         processTemp.id = '';
                         processTemp.is_multi_row = false;count++;
-                        processTemp.serial_number = _this.processes[index].serial_number + 1;
-                        _this.processes.splice(index + 1, 0, processTemp);
+                        processTemp.serial_number = this.processes[index].serial_number + 1;
+                        this.processes.splice(index + 1, 0, processTemp);
                     });
                 },
                 //导出excel
                 processExport(checkAllSign) {
                     let url = '{{url('process/export')}}';
                     let token='{{ csrf_token() }}';
-                    //excelExport 定义在 js/queryForm/export.js
                     excelExport(checkAllSign,checkData,url,this.sum,token);
                 },
                 //获取登记工时
@@ -1336,15 +1311,6 @@
                         tempTip.show('回滚失败!网络错误:' + err);
                     })
                 },
-                //vue绑定的name  type:移入移出类型
-                changeStyle(name, type) {
-                    let domList = document.getElementsByName(name);
-                    let color = '';
-                    if (type) color = 'rgba(0, 0, 0, 0.15)';
-                    for (let i = 0; i < domList.length; i++) {
-                        domList[i].style.backgroundColor = color;
-                    }
-                },
                 destroy(code, id) {
                     if (!confirm('确定要删除“' + code + "”吗?")) return;
                     let _this = this;