Procházet zdrojové kódy

冻结BUG,库存js表头组件化(export未组件化)

Zhouzhendong před 5 roky
rodič
revize
068264e6c0

+ 12 - 5
app/Http/Controllers/ProcessController.php

@@ -209,7 +209,7 @@ class ProcessController extends Controller
         $this->log(__METHOD__,"完成二次加工单_".__FUNCTION__,json_encode($process)." || ".json_encode($processStatistic),Auth::user()['id']);
         return ['success'=>true,'data'=>'交接完成'];
     }
-    private function statistic(Process $process){
+    private function statistic($process){
         if (count($process->processDailies)>0){
             $completed_amount=0;
             foreach ($process->processDailies as $processDaily){
@@ -605,20 +605,27 @@ class ProcessController extends Controller
         }
         if (isset($signMap[$msg]))return ['success'=>false,'data'=>'该单已被确认过!'];
         if (isset($signMap['二次加工组确认'])){
-            $signUnitPrice=$process->signUnitPrice();
+            $signUnitPrice=$process->signUnitPrice;
+            DB::beginTransaction();
             if ($signUnitPrice){
                 $process->update(['unit_price' => $signUnitPrice->mark]);
-                $this->statistic($process);
+                $result = $this->statistic($process);
+                if (!$result['success']){
+                    DB::rollBack();
+                    return $result['data'];
+                }
             }
             $process->createSign('财务确认');
             $process->destroySign();
+            DB::commit();
             return ['success'=>true,'data'=>false];
         }
         if (isset($signMap['财务确认'])){
-            $signUnitPrice=$process->signUnitPrice();
+            $signUnitPrice=$process->signUnitPrice;
             if ($signUnitPrice){
                 $process->update(['unit_price' => $signUnitPrice->mark]);
-                $this->statistic($process);
+                $result = $this->statistic($process);
+                if (!$result['success'])return $result['data'];
             }
             $process->createSign('二次加工组确认');
             $process->destroySign();

+ 2 - 1
app/Process.php

@@ -99,6 +99,7 @@ class Process extends Model
     }
 
     public function destroySign(){
-        Sign::where('signable_type','processes')->where('signable_id',$this->id)->where('field','unit_price')->delete();
+        Sign::where('signable_type','processes')->where('signable_id',$this->id)->where('field','unit_price')
+            ->orWhere('field','update_unit_price_value')->delete();
     }
 }

+ 1 - 1
app/Services/ProcessService.php

@@ -10,7 +10,7 @@ use Illuminate\Http\Request;
 Class ProcessService
 { 
     private function conditionQuery(Request $request){
-        $processes=Process::filterAuthorities()->with(['tutorials','signs','processesContents'=>function($query){
+        $processes=Process::filterAuthorities()->with(['tutorials','signs','signUnitPrice','processesContents'=>function($query){
             return $query->with(['commodity'=>function($query){
                 return $query->with('barcodes');
             }]);

+ 53 - 171
resources/views/inventory/statement/changeInventory.blade.php

@@ -4,91 +4,17 @@
 @section('content')
     @component('inventory.statement.menu')@endcomponent
 <div id="list" class="d-none card container-fluid" style="min-width: 1500px">
-    <form method="GET" action="{{url('inventory/statement/changeInventory')}}" id="form">
-        <table class="table  table-sm table-bordered text-nowrap  mb-0">
-            <tr v-if="isBeingFilterConditions">
-                <td colspan="10">
-                    <div class="col" style="padding:0">
-                        <a  href="{{url('inventory/statement/changeInventory')}}"><span class="btn btn-warning text-dark">清除过滤条件</span></a>
-                    </div></td>
-            </tr>
-            <tr>
-                <td >
-                    <select name="paginate" v-model="filterData.paginate" class="tooltipTarget form-control form-control-sm" style="vertical-align: middle;max-width: 100px" @change="submit">
-                        <option value="50">50行</option>
-                        <option value="100">100行</option>
-                        <option value="200">200行</option>
-                        <option value="500">500行</option>
-                        <option value="1000">1000行</option>
-                    </select></td>
-                <td >
-                    <div class="form-inline">
-                    <input type="date" name="date_start" style="max-width: 150px" class="form-control form-control-sm tooltipTarget" title="选择显示指定日期的起始时间"
-                           v-model="filterData.date_start" :class="filterData.created_at_start?'bg-warning':''">
-                    <select v-model="filterData.range" name="range" @change="submit" title="查询内容的日期范围" class="form-control form-control-sm tooltipTarget m-2">
-                        <option value="1">近一天</option>
-                        <option value="3">近三天</option>
-                        <option value="7" selected>近七天</option>
-                        <option value="30">近三十天</option>
-                    </select></div>
-                </td>
-                <td>
-                    <input name="TOLocation" style="max-width: 200px" v-model="filterData.TOLocation" class="form-control form-control-sm tooltipTarget" placeholder="库位" :class="filterData.TOLocation?'bg-warning':''">
-                </td>
-                <td >
-                    <input name="LotAtt05" style="max-width: 200px" v-model="filterData.LotAtt05" class="form-control form-control-sm tooltipTarget" placeholder="属性仓" :class="filterData.LotAtt05?'bg-warning':''">
-                </td>
-                <td >
-                    <input style="max-width: 150px" type="date" class="form-control form-control-sm tooltipTarget" name="LotAtt02_start" title="选择显示失效日期的起始时间"
-                           v-model="filterData.LotAtt02_start" :class="filterData.LotAtt02_start?'bg-warning':''" >
-                </td>
-                <td colspan="5"></td>
-            </tr>
-            <tr>
-                <td >
-                    <div class="form-inline">
-                    <input type="text" class="form-control form-control-sm tooltipTarget" placeholder="客户"
-                           style="width:70px" @input="owner_seek"
-                           title="输入关键词快速定位下拉列表,回车确定">
-                    <select name="descr_c" v-model="filterData.descr_c" @change="submit" style="max-width: 100px" class="form-control form-control-sm tooltipTarget"  title="选择要显示的客户" :class="filterData.descr_c?'bg-warning':''">
-                        <option >    </option>
-                        <option v-for="owner in owners" :value="owner.descr_c" >@{{owner.descr_c}}</option>
-                    </select></div>
-                </td>
-                <td >
-                    <input style="max-width: 150px" type="date" class="form-control form-control-sm tooltipTarget" name="date_end" title="选择显示指定日期的结束时间"
-                           v-model="filterData.date_end" :class="filterData.created_at_end?'bg-warning':''" >
-                </td>
-                <td>
-                    <input style="max-width: 200px" name="SKU" v-model="filterData.SKU" class="form-control form-control-sm tooltipTarget" placeholder="产品编码" :class="filterData.SKU?'bg-warning':''">
-                </td>
-                <td >
-                    <input style="max-width: 200px" name="ALTERNATE_SKU1" v-model="filterData.ALTERNATE_SKU1" class="form-control form-control-sm tooltipTarget" placeholder="产品条码" :class="filterData.ALTERNATE_SKU1?'bg-warning':''">
-                </td>
-                <td >
-                    <input style="max-width: 150px" type="date" class="form-control form-control-sm tooltipTarget" name="LotAtt02_end" title="选择显示失效日期的结束时间"
-                           v-model="filterData.LotAtt02_end" :class="filterData.LotAtt02_end?'bg-warning':''" >
-                </td>
-                <td colspan="5">
-                    <input type="submit" class="btn btn-sm btn-outline-dark pull-left" value="按条件搜索">
-                </td>
-            </tr>
-            <tr>
-                <td colspan="9">
-                               <span class="dropdown">
-                                        <button class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget" :class="[checkData.length>0?'btn-dark text-light':'']"
-                                                data-toggle="dropdown" title="导出所有页将会以搜索条件得到的过滤结果,将其全部记录(每一页)导出">
-                                            导出Excel
-                                        </button>
-                                        <div class="dropdown-menu">
-                                            <a class="dropdown-item" @click="processExport(1)" href="javascript:">导出勾选内容</a>
-                                            <a class="dropdown-item" @click="processExport(2)" href="javascript:">导出所有页</a>
-                                        </div>
-                                    </span>
-                </td>
-            </tr>
-        </table>
-    </form>
+    <div id="form_div"></div>
+    <span class="dropdown">
+        <button class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget" :class="[checkData.length>0?'btn-dark text-light':'']"
+                data-toggle="dropdown" title="导出所有页将会以搜索条件得到的过滤结果,将其全部记录(每一页)导出">
+            导出Excel
+        </button>
+        <div class="dropdown-menu">
+            <a class="dropdown-item" @click="processExport(1)" href="javascript:">导出勾选内容</a>
+            <a class="dropdown-item" @click="processExport(2)" href="javascript:">导出所有页</a>
+        </div>
+    </span>
     <table class="table table-sm table-striped table-bordered table-hover text-nowrap card-body mt-2">
         <tr>
             <th>
@@ -131,20 +57,6 @@
             <td><span v-if="oracleActTransactingLog.占用数量">@{{ oracleActTransactingLog.占用数量 }}</span><span v-else>0</span></td>
         </tr>
     </table>
-    <form method="post" hidden action="{{url('inventory/statement/changeInventory/export')}}" id="checkDataForm">
-        @csrf
-        <input name="checkData" :value="checkData | json">
-        <input name="export" :value="filterData.export">
-        <input name="date_start" :value="filterData.date_start">
-        <input name="date_end" :value="filterData.date_end">
-        <input name="SKU" :value="filterData.SKU">
-        <input name="TOLocation" :value="filterData.TOLocation">
-        <input name="LotAtt05" :value="filterData.LotAtt05">
-        <input name="LotAtt02_start" :value="filterData.LotAtt02_start">
-        <input name="LotAtt02_end" :value="filterData.LotAtt02_end">
-        <input name="descr_c" :value="filterData.descr_c">
-        <input name="ALTERNATE_SKU1" :value="filterData.ALTERNATE_SKU1">
-    </form>
     <div >
         <button type="button" @click="pageUp()" :readonly="page>1?false:true" class="btn btn-sm " :class="page>1?'btn-outline-info':''">上一页</button>
         <button type="button" @click="pageDown()" :readonly="page<maxPage?false:true" class="btn btn-sm m-3" :class="page<maxPage?'btn-outline-info':''">下一页</button>
@@ -155,43 +67,52 @@
 @endsection
 
 @section('lastScript')
+    <script type="text/javascript" src="{{asset('js/queryForm/export.js')}}"></script>
+    <script type="text/javascript" src="{{asset('js/queryForm/queryForm.js')}}"></script>
     <script>
         new Vue({
             el:"#list",
             data:{
                 oracleActTransactingLogs:{!! $oracleActTransactingLogs !!},
                 page:Number('{{$page}}'),
-                filterData:{date_start:'',date_end:'',SKU:'',paginate:"50",TOLocation:'',range:'',
-                    LotAtt05:'',LotAtt02_start:'',LotAtt02_end:'',descr_c:'',ALTERNATE_SKU1:'',export:''},
                 owners:[
                     @foreach($owners as $owner)
-                    {!! $owner !!},
+                    {name:'{{$owner->descr_c}}',value:'{{$owner->descr_c}}'},
                     @endforeach
                 ],
                 checkData:[],
                 maxPage:1,
-                sum:0
+                sum:0,
+                date:[{name:'1',value:'近一天'},{name:'3',value:'近三天'},{name:'7',value:'近一周'},{name:'30',value:'近一月'},],
             },
             mounted:function () {
                 $(".tooltipTarget").tooltip({'trigger':'hover'});
-                this.initInputs();
                 $("#list").removeClass('d-none');
                 if (this.oracleActTransactingLogs.length>0){
                     this.maxPage=Math.ceil(this.oracleActTransactingLogs[0].sum/50);
                     this.sum=this.oracleActTransactingLogs[0].sum;
                 }
-            },
-            computed:{
-                isBeingFilterConditions:function(){
-
-                    for(let key in this.filterData){
-                        if(this.filterData[key] && key!='paginate'){
-                            return true
-                        }
-                    }
-                    return false;
-                },
-
+                let data=[
+                    [
+                        {name:['date_start','range'],type:'dataTime_select',tip:['选择创建日期的起始时间','查询内容的日期范围'],placeholder:['','查询内容的日期范围'],data: this.date},
+                        {name:'TOLocation',type:'input',tip:'库位:糊模查找需要在左边打上%符号',placeholder: '库位'},
+                        {name:'LotAtt05',type:'input',tip:'属性仓:糊模查找需要在左边打上%符号',placeholder: '属性仓'},
+                        {name:'LotAtt02_start',type:'dataTime',tip:'选择显示失效日期的起始时间'},
+                        {name:'descr_c',type:'select_multiple_select',tip:['输入关键词快速定位下拉列表,回车确定','选择要显示的客户'],
+                            placeholder:['货主','定位或多选货主'],data:this.owners},
+                    ],
+                    [
+                        {name:'date_end',type:'dataTime',tip:'选择创建日期的结束时间'},
+                        {name:'SKU',type:'input',tip:'产品编码:糊模查找需要在左边打上%符号',placeholder: '产品编码'},
+                        {name:'ALTERNATE_SKU1',type:'input',tip:'产品条码:糊模查找需要在左边打上%符号',placeholder: '产品条码'},
+                        {name:'LotAtt02_end',type:'dataTime',tip:'选择显示失效日期的结束时间'},
+                    ],
+                ];
+                this.form = new query({
+                    el:'#form_div',
+                    condition:data
+                });
+                this.form.init();
             },
             watch:{
                 checkData:{
@@ -206,59 +127,32 @@
                 }
             },
             methods:{
-                initInputs:function(){
-                    let data=this;
-                    let uriParts =decodeURI(location.href).split("?");
-                    if(uriParts.length>1){
-                        let params = uriParts[1].split('&');
-                        params.forEach(function(paramPair){
-                            let pair=paramPair.split('=');
-                            let key = pair[0], val = pair[1];
-                            $('input[name="'+key+'"]').val(val);
-                            $('select[name="'+key+'"]').val(val);
-                            decodeURI(data.filterData[key]=val);
-                        });
-                    }
-                },
                 pageUp(){
                     if (this.page<=1)return;
-                     this.page=this.page-1;
-                     this.href();
+                    this.href(this.page-1);
                 },
                 pageDown(){
                     if (this.page>=this.maxPage)return;
-                    this.page=this.page+1;
-                    this.href();
+                    this.href(this.page+1);
                 },
                 pageSkip(e){
-                  if (Number(e.target.value)<=0 || Number(e.target.value)>this.maxPage){
-                      tempTip.setDuration(2000);
-                      tempTip.show('页数不存在! ');
-                      return
-                  }
-                  this.page=e.target.value;
-                  this.href();
+                    if (Number(e.target.value)<=0 || Number(e.target.value)>this.maxPage){
+                        tempTip.setDuration(2000);
+                        tempTip.show('页数不存在! ');
+                        return
+                    }
+                    this.href(e.target.value);
                 },
-                href(){
-                    let url="{{url('inventory/statement/changeInventory?page=')}}"+this.page;
-                    if (this.filterData.date_start)url+="&&date_start="+this.filterData.date_start;
-                    if (this.filterData.date_end)url+="&&date_end="+this.filterData.date_end;
-                    if (this.filterData.SKU)url+="&&SKU="+this.filterData.SKU;
-                    if (this.filterData.paginate)url+="&&paginate="+this.filterData.paginate;
-                    if (this.filterData.TOLocation)url+="&&TOLocation="+this.filterData.TOLocation;
-                    if (this.filterData.LotAtt05)url+="&&LotAtt05="+this.filterData.LotAtt05;
-                    if (this.filterData.LotAtt02_start)url+="&&LotAtt02_start="+this.filterData.LotAtt02_start;
-                    if (this.filterData.LotAtt02_end)url+="&&LotAtt02_end="+this.filterData.LotAtt02_end;
-                    if (this.filterData.ALTERNATE_SKU1)url+="&&ALTERNATE_SKU1="+this.filterData.ALTERNATE_SKU1;
-                    if (this.filterData.descr_c)url+="&&descr_c="+this.filterData.descr_c;
-                    if (this.filterData.range)url+="&&range="+this.filterData.range;
+                href(page){
+                    let url = document.URL;
+                    if (url.indexOf('page='+this.page) != -1){
+                        url = url.replace("page="+this.page,"page="+page);
+                    }else{
+                        if (url.indexOf('?') == -1) url += "?page="+page;
+                        else url += "&page="+page;
+                    }
                     window.location.href=url;
                 },
-                //提交表单
-                submit:function(){
-                    let form = $("#form");
-                    form.submit();
-                },
                 //全选事件
                 checkAll(e){
                     if (e.target.checked){
@@ -271,18 +165,6 @@
                         this.checkData = [];
                     }
                 },
-                //寻找客户
-                owner_seek:function (e) {
-                    let _this=this;
-                    let $val=e.target.value;
-                    if($val==='')_this.filterData.descr_c='';
-                    else
-                        _this.owners.forEach(function (owner) {
-                            if (owner.descr_c.includes($val)){
-                                _this.filterData.descr_c=owner.descr_c;
-                            }
-                        });
-                },
                 processExport:function(value){
                     if (value==1&&this.checkData.length <= 0) {
                         tempTip.setDuration(2000);

+ 9 - 2
resources/views/order/index/delivering.blade.php

@@ -19,6 +19,13 @@
                         </div>
                     </span>
                     @can('订单管理-批量备注')<button @click="modal()" type="button" class="btn btn-sm ml-2 btn-outline-primary">批量备注追加</button>@endcan
+                    @can('订单管理-批量备注')<button @click="modal()" type="button" class="btn btn-sm ml-2 btn-outline-primary">批量备注追加</button>@endcan
+                    @can('订单管理-编辑')
+                        <span class="btn btn-sm tooltipTarget ml-2" @click="freezeAll" style="cursor: pointer" title="订单的冻结条件要只局限在“创建订单”,“分配完成”,“拣货完成”,“播种完成”"
+                              :class="[checkData.length>0?'btn-dark':'btn-outline-dark']">冻结</span>
+                        <span class="btn btn-sm tooltipTarget ml-2" @click="deAllocationAll" style="cursor: pointer"  title="订单的取消分配条件要只局限在“分配完成”或“部分分配”"
+                              :class="[checkData.length>0?'btn-dark':'btn-outline-dark']">取消分配</span>
+                    @endcan
                 </div>
                 <div class="modal fade " style="top: 20%" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                     <div class="modal-dialog">
@@ -137,9 +144,9 @@
                         <td>
                             @can('订单管理-编辑')
                                 <button v-if="order.releasestatus!=='H'" @click="freeze(order.orderno,order.waveno)" class="btn btn-sm btn-outline-dark text-nowrap"
-                                        :disabled="!(order.codename_c==='创建订单'||order.codename_c==='分配完成'||order.codename_c==='拣货完成'||order.codename_c==='播种完成')">冻结</button>
+                                        :disabled="!(order.ordercodename==='创建订单'||order.ordercodename==='分配完成'||order.ordercodename==='拣货完成'||order.ordercodename==='播种完成')">冻结</button>
                                 <button v-else @click="thaw(order.orderno,order.waveno)" class="btn btn-sm btn-outline-danger text-nowrap"
-                                        :disabled="!(order.codename_c==='创建订单'||order.codename_c==='分配完成'||order.codename_c==='拣货完成'||order.codename_c==='播种完成')">解冻</button>
+                                        :disabled="!(order.ordercodename==='创建订单'||order.ordercodename==='分配完成'||order.ordercodename==='拣货完成'||order.ordercodename==='播种完成')">解冻</button>
                             @else
                                 @{{ order.releasestatus }}
                             @endcan

+ 2 - 1
resources/views/process/create.blade.php

@@ -4,7 +4,7 @@
     <div id="nav2">
         @component('process.menu')@endcomponent
     </div>
-    <div class="container-fluid" id="list">
+    <div class="container-fluid d-none" id="list">
         <div class="card col-md-8 offset-md-2">
             <div class="card-body">
                 <div class="modal fade" id="pasteData" tabindex="-1" role="dialog" aria-labelledby="pasteDataTitle" aria-hidden="true">
@@ -281,6 +281,7 @@
             },
             mounted:function(){
                 $(".tooltipTarget").tooltip({'trigger':'hover'});
+                $("#list").removeClass('d-none');
             },
             methods:{
                 //新增库单据

+ 7 - 3
resources/views/process/index.blade.php

@@ -271,14 +271,15 @@
                             <div v-if="processOne.status=='交接完成'">
                                 <div v-if="processOne.signs.length<=0">
                                     <div v-if="processOne.is_update_unit_price" >
-                                        <input type="text" :value="processOne.unit_price" :id="'unit_price_'+processOne.id" class="form-control form-control-sm" style="min-width: 50px;">
+                                        <input type="text" :value="processOne.unit_price"
+                                               :id="'unit_price_'+processOne.id" class="form-control form-control-sm" style="min-width: 50px;">
                                         <button type="button" class="btn btn-sm btn-outline-success" @click="updateUnitPrice(processOne)">确定</button>
                                         <button type="button" class="btn btn-sm btn-outline-danger" @click="processOne.is_update_unit_price=false;">取消</button>
                                     </div>
                                     <input readonly @click="processOne.is_update_unit_price=true;" v-else style="cursor: pointer;min-width: 50px" :value="processOne.unit_price" class="form-control form-control-sm">
                                 </div>
                                 <div v-else @mouseleave="processOne.is_update_unit_price=false;" @mouseenter="processOne.is_update_unit_price=true;">
-                                    <span class="flicker" style="cursor: move">@{{ processOne.unit_price }}</span>
+                                    <span class="flicker" style="cursor: move">@{{ processOne.signUnitPrice ? processOne.signUnitPrice : processOne.unit_price }}</span>
                                     <div v-if="processOne.is_update_unit_price" style="position: absolute;width: 150px;background-color: white;white-space: normal;margin-left: -50px"
                                          @mouseleave="processOne.is_update_unit_price=false;" @mouseenter="processOne.is_update_unit_price=true;">
                                         <p class="text-center text-dark font-weight-bold">待确认</p>
@@ -484,7 +485,7 @@
                 processes:[
                     @foreach($processes as $processOne)
                     {id:'{{$processOne->id}}',code:'{{$processOne->code}}',owner_name:'{{$processOne->owner_name}}',owner_id:'{{$processOne->owner_id}}',operatorLogs:{!! $processOne->operatorLogs !!},
-                        process_method_name:'{{$processOne->process_method_name}}',amount:'{{$processOne->amount}}',type:'{{$processOne->type}}',signs:{!!$processOne->signs  !!}
+                        process_method_name:'{{$processOne->process_method_name}}',amount:'{{$processOne->amount}}',type:'{{$processOne->type}}',signs:{!!$processOne->signs  !!},signUnitPrice:'{{$processOne->signUnitPrice ? $processOne->signUnitPrice->mark :''}}'
                         ,tutorials:{!! $processOne->tutorials !!},processesContents:{!! $processOne->processesContents !!},unit_price:'{{$processOne->unit_price}}',created_at:'{{$processOne->created_at}}',
                         completed_amount:'{{$processOne->completed_amount}}',status:'{{$processOne->status}}',remark:'{{$processOne->remark}}',detailFolding:false,openProcessHour:false,is_multi_row:false,is_verifier_show:false,is_update_unit_price:false,
                         buttonTexts:{'审核':'审','回滚':'回','编辑':'编','接单':'接','驳回':'驳','质量验收':'验','完成':'完','交接完成':'交','查看单据':'查','登记工时':'登'},
@@ -1429,6 +1430,7 @@
                             if (response.data.success) {
                                 process.signs.push(response.data.sign);
                                 process.is_update_unit_price = false;
+                                process.unit_price = unit_price;
                                 tempTip.setDuration(2000);
                                 tempTip.showSuccess('“' + process.code + "”价格修改成功,确认通过后生效!");
                                 return;
@@ -1460,7 +1462,9 @@
                                 }else{
                                     _this.signs[process.code]=[];
                                     process.signs=[];
+                                    process.unit_price = process.signUnitPrice;
                                 }
+                                if (process.is_update_unit_price)process.is_update_unit_price = false;
                                 tempTip.setDuration(2000);
                                 tempTip.showSuccess('“' + process.code + "”新价格通过" + msg + "审核!");
                                 return;