Преглед изворни кода

修改波次查询exel功能 by 'zengjun2'

ajun пре 5 година
родитељ
комит
df91ba5926

+ 2 - 0
app/Http/Controllers/WaveController.php

@@ -74,8 +74,10 @@ class WaveController extends Controller
 
     public function cancelPrinting(Request $request){
         if(!Gate::allows('订单管理-波次-取消打印标记')){ return ['success'=>false,'fail_info'=>'没有权限,请联系管理员'];  }
+
         $waveService = app("WaveService");
         $meg = ['success'=>false];
+
         $ids = $request->input("ids");
         $meg = $waveService->cancelPrint($ids);
         if($meg['fail_info']){

+ 23 - 5
app/Services/WaveService.php

@@ -53,7 +53,6 @@ class WaveService
     // cancel Print
     public function cancelPrint($ids)
     {
-        DB::enableQueryLog();
         $meg = ['success' => false, 'fail_info' => null];
         if (!$ids) {
             $meg['fail_info'] = '没有选中需要取消打印标记的波次!';
@@ -62,6 +61,11 @@ class WaveService
         if (is_string($ids)) {
             $ids = [$ids];
         }
+        $count = $this->verfifyIds($ids);
+        if(!$count) {
+            $meg['fail_info'] = "取消打印的波次中有不符合条件的波次";
+            return $meg;
+        }
         $cancelPrint = OracleDOCWaveHeader::whereIn("WAVENO", $ids)->update(['udfprintflag2' => 'N','UserDefine2'=>'']);
         if (!$cancelPrint) {
             $meg['fail_info'] = '没有选中需要取消打印标记的波次!';
@@ -92,7 +96,7 @@ class WaveService
             $childSql .= " and addTime < '" . $end_time . " 23:59:59'";
         }
         if ($wave_num) {
-            $childSql .= " and waveNo like '" . $wave_num . "'";
+            $childSql .= " and waveNo like '" .trim($wave_num). "'";
         }
         if ($wave_status) {
             $childSql .= " and waveStatus = " . $wave_status;
@@ -129,8 +133,13 @@ class WaveService
             $childSql .= " and addTime < '" . $request->input('end_time') . " 23:59:59' ";
         }
         if ($request->input('wave_num')) {
-            $sql = $this->getWaveNoString($request->input('wave_num'));
-            $childSql .= " and WaveNo in (" .$sql . ") ";
+            $wave_num = $request->input('wave_num');
+            $wave_num = $this->getWaveNoString($wave_num);
+            if(strpos($wave_num,',')){
+                $childSql .= " and WaveNo in (" .$wave_num . ") ";
+            }else{
+                $childSql .= " and WaveNo like '" .$wave_num . "' ";
+            }
         }
         if ($request->input('wave_status')) {
             $childSql .= " and WaveStatus =  '" . $request->input('wave_status') . "' ";
@@ -173,11 +182,14 @@ class WaveService
         ]];
         return $arr;
     }
-    public  function getWaveNoString($wave_num){
+    public function getWaveNoString($wave_num){
         $sqlString = '';
         if(!$wave_num){
             return $sqlString;
         }
+        if(strpos($wave_num,"%")){
+            return $wave_num;
+        }
         if(strpos($wave_num,",") ){
 
             $arr = explode(',',$wave_num);
@@ -193,4 +205,10 @@ class WaveService
         }
         return $sqlString;
     }
+
+    public function verfifyIds($ids){
+        $sql =  "select count(1) count from DOC_WAVE_HEADER where  WaveNo in (".$this->getWaveNoString(implode(',',$ids)).") and WAVESTATUS ='99' and UdfPrintFlag2 ='Y'";
+        $count=  DB::connection('oracle')->select(DB::raw($sql))[0]->count;
+        return $count = 0;
+    }
 }

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

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

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

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

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

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

+ 12 - 8
resources/views/order/wave/search.blade.php

@@ -21,7 +21,7 @@
                             <a class="dropdown-item" @click="exportExcel()" href="javascript:">导出所有页</a>
                         </div>
 
-                        <button type="button" class="btn btn-sm tooltipTarget btn-outline-dark" @click="batchCancelPrint">取消打印标记</button>
+                       {{-- <button type="button" class="btn btn-sm tooltipTarget btn-outline-dark" @click="batchCancelPrint">取消打印标记</button>--}}{{-- <button type="button" class="btn btn-sm tooltipTarget btn-outline-dark" @click="batchCancelPrint">取消打印标记</button>--}}
                     </td>
                 </tr>
 
@@ -44,7 +44,7 @@
                     <th>快递单打印人</th>
                     <th>快递单打印于</th>
                     @can("订单管理-波次-取消打印标记")
-                        <th>取消打印</th>
+                        <th>打印标记</th>
                     @endcan
                 </tr>
 
@@ -66,7 +66,7 @@
                     <td class="text-muted">@{{ wave.expressPrintTime }}</td>{{--快递单号打时间--}}
                     @can("订单管理-波次-取消打印标记")
                     <td class="text-center">
-                        <button v-if="wave.waveStatus !== '99' && wave.UdfPrintFlag2 === 'Y' " type="button" class="btn btn-sm btn-outline-dark text-nowrap" :data-value="wave.waveNo" @click="singleCancelPrint($event)">取消</button>
+                        <button v-if="wave.waveStatus !== '99' && wave.UdfPrintFlag2 === 'Y' " type="button" class="btn btn-sm btn-outline-dark text-nowrap" :data-value="wave.waveNo" @click="singleCancelPrint($event)">取消打印标记</button>
                     </td>
                     @endcan
                 </tr>
@@ -118,7 +118,7 @@
                 let data = [[
                     {name: 'start_time', type: 'dataTime', tip: '选择显示指定日期的起始时间', placeholder: ''},
                     {name: 'end_time', type: 'dataTime', tip: '选择显示指定日期的结束时间', placeholder: ''},
-                    {name: 'wave_num', type: 'input', tip: '波次编号:支持模糊搜索,回车提交', placeholder: ''},
+                    {name: 'wave_num', type: 'input', tip: '波次编号:支持模糊搜索,回车提交', placeholder: '波次编号'},
                     // {name:'wave_status',type:'select',tip:'',placeholder:'',data:[]},
                 ]];
                 this.form = new query({
@@ -136,6 +136,7 @@
                     }
                 },
                 batchCancelPrint: function () {
+                    console.log(123);
                     if (this.checkData === 0) {
                         tempTip.show('没有勾选记录');
                         return;
@@ -146,7 +147,7 @@
                 cancelPrint: function (ids, type = 'string') {
                     let _this = this;
                     // console.log(ids);
-                    axios.post("{{url("wave/cancelPrinting")}}", {ids: ids}).then(function (res) {
+                    axios.post("{{url("order/cancelPrinting")}}", {ids: ids}).then(function (res) {
                         if (res.data.success) {
                             _this.waves.forEach(function (wave) {
                                 if (ids.includes(wave.waveNo)) {
@@ -164,7 +165,7 @@
                             $(".checkItem").prop("checked",false);
                         } else {
                             tempTip.setDuration(2500);
-                            tempTip.show('标记勾选内容取消打印失败,错误:' + response.data.fail_info);
+                            tempTip.show('标记勾选内容取消打印失败,错误:' + res.data.fail_info);
                         }
                     }).catch(function (err) {
                         tempTip.setDuration(4000);
@@ -189,6 +190,10 @@
                     let search = '';
                     if(string === "all"){
                     }else if(string === 'pitch'){
+                        if(this.getCheckedIds().length === 0){
+                            tempTip.show('没有勾选记录');
+                            return;
+                        }
                         if(this.checkData){
                             let seachs =this.checkData.map(function (value) {
                                 return "'"+value+"'";
@@ -199,7 +204,7 @@
                     let url = window.location.search ;
                     url = url.length< 2 ? '' : url.substring(1);
                     console.log(search,url);
-                    window.open("{{url('wave/exportExcel?')}}"+search+url);
+                    window.open("{{url('order/wave/exportExcel?')}}"+search+"&"+url);
                     // todo
                    /* let instance = axios.create({
                         {{--url:'{{url("wave/exportExcel")}}',--}}
@@ -245,7 +250,6 @@
                         this.checkData = [];
                     }
                 },
-
                 getCheckedIds(){
                     // HACK
                     let values = [];

+ 5 - 5
routes/web.php

@@ -313,13 +313,13 @@ Route::group(['prefix'=>'order'],function(){
 });
 
 /**
- * 新建波次
+ * 波次
  */
-Route::group(['prefix'=>'wave'],function(){
+Route::group(['prefix'=>'order'],function(){
     // index
-    Route::get('index','WaveController@index');
+    Route::get('wave/index','WaveController@index');
     // cancel printing by id or ids
-    Route::post('cancelPrinting','WaveController@cancelPrinting');
+    Route::post('wave/cancelPrinting','WaveController@cancelPrinting');
     // export Excel
-    Route::any('exportExcel','WaveController@exportExcelOnParams');
+    Route::any('wave/exportExcel','WaveController@exportExcelOnParams');
 });