Kaynağa Gözat

Merge branch 'Haozi'

LD 5 yıl önce
ebeveyn
işleme
4d2a0830a7

+ 5 - 2
app/Http/Controllers/InventoryController.php

@@ -3,6 +3,7 @@
 namespace App\Http\Controllers;
 
 use App\OracleBasCustomer;
+use App\Owner;
 use App\Services\AllInventoryService;
 use App\Services\InventoryDailyLogService;
 use App\Services\InventoryService;
@@ -25,7 +26,8 @@ class InventoryController extends Controller
         if(!Gate::allows("库存管理-库存")){ return redirect(url('/'));  }
         $oracleActTransactingLogs=app('inventoryService')->paginate($request->input());
         $oracleActTransactingLogs=json_encode($oracleActTransactingLogs);
-        $owners=OracleBasCustomer::query()->select('customerid','descr_c')->where('customer_type','OW')->where('active_flag','Y')->get();
+//        $owners=OracleBasCustomer::query()->select('customerid','descr_c')->where('customer_type','OW')->where('active_flag','Y')->get();
+        $owners=Owner::filterAuthorities()->select(['code', 'name'])->get();
         $isTotalStock=false;
         $page = $request->page ?? 1;
         return view('inventory.statement.changeInventory',compact('oracleActTransactingLogs','page','owners','isTotalStock'));
@@ -38,7 +40,8 @@ class InventoryController extends Controller
         $service = app('allInventoryService');
         $oracleActTransactingLogs= $service->paginate($request->input());
         $oracleActTransactingLogs=json_encode($oracleActTransactingLogs);
-        $owners=OracleBasCustomer::query()->select('customerid','descr_c')->where('customer_type','OW')->where('active_flag','Y')->get();
+//        $owners=OracleBasCustomer::query()->select('customerid','descr_c')->where('customer_type','OW')->where('active_flag','Y')->get();
+        $owners=Owner::filterAuthorities()->select(['code', 'name'])->get();
         $isTotalStock=true;
         $page = $request->page ?? 1;
         return view('inventory.statement.changeInventory',compact('oracleActTransactingLogs','page','owners','isTotalStock'));

+ 16 - 0
app/Http/Controllers/RejectedController.php

@@ -505,4 +505,20 @@ class RejectedController extends Controller
         }
         return ['success'=>true,'rejectedBill' => $rejectedBill];
     }
+    public function changeRejectedBillRemark(Request $request){
+        if(!Gate::allows('退货管理-编辑备注')){return ['success'=>'false','fail_info'=>'没有权限'];}
+        $id= $request->input('id');
+        $remark = $request->input('remark');
+        if(is_null($id) ){
+            return ['success'=>false,'fail_info'=>'参数异常'];
+        }
+        $rejectedBill=RejectedBill::query()->updateOrCreate([
+            'id'=>$id,
+        ],[
+            'id'=>$id,
+            'remark'=>$remark
+        ]);
+        $this->log(__METHOD__,'添加或者修改退单备注'.__FUNCTION__,json_encode($request->toArray()),Auth::user()['id']);
+        return ['success'=>true,'status'=>$rejectedBill];
+    }
 }

+ 0 - 1
app/LaborReport.php

@@ -77,7 +77,6 @@ class LaborReport extends Model
     }
     public function setRemarkAttribute($remark,$id){
         return Sign::updateOrCreate(['signable_type'=>'labor_reports','signable_id'=>$id,'field'=>'remark'],['mark'=>$remark]);
-
     }
     public function getIsExportGroupAttribute(){
         return $this['check_out_at']? true:false;

+ 28 - 9
app/Services/AllInventoryService.php

@@ -2,11 +2,13 @@
 
 namespace App\Services;
 
+use App\Owner;
 use Illuminate\Support\Facades\DB;
 
 Class AllInventoryService
 {
     public function getSql(array $params, $page=null, $paginate=null){
+        $ownerCodes=Owner::filterAuthorities()->select('code')->get();
         $date_start=$params['date_start'] ?? null;
         $range = $params['range'] ?? null;
         if ($range)$date_start=date('Y-m-d',strtotime('-'.$range." day"));
@@ -27,6 +29,23 @@ Class AllInventoryService
         $sql.=' left join BAS_Customer customer on customer.CustomerID=storeStatus.CUSTOMERID ';
         $sql.=' left join BAS_SKU sku on sku.SKU=storeStatus.SKU and sku.CUSTOMERID=storeStatus.CUSTOMERID ';
         $sql.=' left join INV_LOT_ATT lot on lot.LOTNUM = storeStatus.LOTNUM AND lot.CUSTOMERID = storeStatus.CUSTOMERID ';
+        if ($customerid){
+            $sql .= ' where storeStatus.CUSTOMERID in (';
+            $arr = explode(',',$customerid);
+            foreach ($arr as $index => $data){
+                if ($index != 0)$sql .= ',';
+                $sql .= "'".$data."'";
+            }
+            $sql .= ') ';
+        }
+        if (!$customerid&&$ownerCodes){
+            $sql .= ' where storeStatus.CUSTOMERID in (';
+            foreach ($ownerCodes as $index => $data){
+                if ($index != 0)$sql .= ',';
+                $sql .= "'".$data['code']."'";
+            }
+            $sql .= ') ';
+        }
         $sql.=' group by storeStatus.LocationID,customer.Descr_C,sku.SKU,sku.ALTERNATE_SKU1 ';
         $sql.=' ,sku.Descr_C,lot.LotAtt05,lot.LotAtt08,lot.LotAtt02,lot.LotAtt04 ';
         $sql.=' , storeStatus.QTY, storeStatus.QtyAllocated,storeStatus.CUSTOMERID,storeStatus.ADDTIME  ';
@@ -38,15 +57,15 @@ Class AllInventoryService
         if ($date_end)$sql.=" and 创建时间 < to_date('".$date_end." 23:59:59','yyyy-mm-dd hh24:mi:ss') ";
         if ($LotAtt02_start)$sql.=" and 失效日期 >='".$LotAtt02_start." 00:00:00' ";
         if ($LotAtt02_end)$sql.=" and 失效日期 <='".$LotAtt02_end." 23:59:59' ";
-        if ($customerid){
-            $sql .= ' and 客户 in (';
-            $arr = explode(',',$customerid);
-            foreach ($arr as $index => $data){
-                if ($index != 0)$sql .= ',';
-                $sql .= "'".$data."'";
-            }
-            $sql .= ') ';
-        }
+//        if ($customerid){
+//            $sql .= ' and 客户 in (';
+//            $arr = explode(',',$customerid);
+//            foreach ($arr as $index => $data){
+//                if ($index != 0)$sql .= ',';
+//                $sql .= "'".$data."'";
+//            }
+//            $sql .= ') ';
+//        }
         if ($ALTERNATE_SKU1)$sql.=" and 产品条码 like '".$ALTERNATE_SKU1."' ";
         if ($page&&$paginate)$sql.="  and ROWNUM<='".$page*$paginate."'";
         $sql.=' )  ';

+ 34 - 0
app/Services/InventoryService.php

@@ -5,12 +5,14 @@ namespace App\Services;
 
 use App\inventoryDailyLog;
 use App\InventoryDailyLoggingOwner;
+use App\Owner;
 use App\Services\common\QueryService;
 use Illuminate\Support\Facades\DB;
 
 class InventoryService
 {
     public function getSql(array $params,$page=null,$paginate=null){
+        $ownerCodes=Owner::filterAuthorities()->select('code')->get();
         $date_start=$params['date_start'] ?? null;
         $range = $params['range'] ?? null;
         if ($range)$date_start=date('Y-m-d',strtotime('-'.$range." day"));
@@ -43,6 +45,14 @@ class InventoryService
             }
             $sql .= ') ';
         }
+        if (!$customerid&&$ownerCodes){
+            $sql .= ' and TOCustomerID in (';
+            foreach ($ownerCodes as $index => $data){
+                if ($index != 0)$sql .= ',';
+                $sql .= "'".$data['code']."'";
+            }
+            $sql .= ') ';
+        }
         $sql.=' group by TOCustomerID, TOLocation,FMSKU,FMLotNum union all ';
         $sql.=' select FMLotNum,FMSKU,FMCUSTOMERID 客户,sum(FMQty_Each) as 移出数量, 0 as 移入数量, FMLOCATION as 库位 ';
         $sql.=" from ACT_Transaction_Log where TransactionType='SO' ";
@@ -59,6 +69,14 @@ class InventoryService
             }
             $sql .= ') ';
         }
+        if (!$customerid&&$ownerCodes){
+            $sql .= ' and FMCUSTOMERID in (';
+            foreach ($ownerCodes as $index => $data){
+                if ($index != 0)$sql .= ',';
+                $sql .= "'".$data['code']."'";
+            }
+            $sql .= ') ';
+        }
         $sql.=' group by FMCustomerID, FMLocation,FMSKU,FMLotNum union all ';
         $sql.=' select FMLotNum,FMSKU,FMCUSTOMERID 客户,sum(FMQty_Each) as 移出数量,0 as 移入数量, FMLocation as 库位 ';
         $sql.=" from ACT_Transaction_Log  where TransactionType='MV' ";
@@ -75,6 +93,14 @@ class InventoryService
             }
             $sql .= ') ';
         }
+        if (!$customerid&&$ownerCodes){
+            $sql .= ' and FMCUSTOMERID in (';
+            foreach ($ownerCodes as $index => $data){
+                if ($index != 0)$sql .= ',';
+                $sql .= "'".$data['code']."'";
+            }
+            $sql .= ') ';
+        }
         $sql.=' group by FMLocation,FMCUSTOMERID,FMSKU,FMLotNum union all ';
         $sql.=' select FMLotNum,FMSKU,TOCustomerID 客户,0 as 移出数量,sum(TOQty_Each)as 移入数量, TOLocation as 库位 ';
         $sql.=" from ACT_Transaction_Log where TransactionType='MV' ";
@@ -91,6 +117,14 @@ class InventoryService
             }
             $sql .= ') ';
         }
+        if (!$customerid&&$ownerCodes){
+            $sql .= ' and TOCustomerID in (';
+            foreach ($ownerCodes as $index => $data){
+                if ($index != 0)$sql .= ',';
+                $sql .= "'".$data['code']."'";
+            }
+            $sql .= ') ';
+        }
         $sql.=' group by TOLocation,TOCustomerID,FMSKU,FMLotNum)stockLog ';
         $sql.=' left join BAS_Customer customer on customer.CustomerID=stockLog.客户 ';
         $sql.=' left join BAS_SKU sku on sku.SKU=stockLog.FMSKU and sku.CUSTOMERID=stockLog.客户 ';

+ 1 - 0
app/Services/RejectedService.php

@@ -28,6 +28,7 @@ class RejectedService
             'created_at_end' => ['alias' => 'created_at', 'endDate' => ' 23:59:59'],
             'owner_id' => ['alias' => 'id_owner', 'multi' => ','],
             'order_number' => ['like' => ''],
+            'remark' => ['like' => '','timeLimit'=>15],
             'logistic_number' => ['like' => ''],
             'mobile_sender' => ['like' => ''],
             'checked_numbers' => ['like' => ''],

+ 29 - 0
database/migrations/2020_10_27_112348_add_rejecteds_authorities.php

@@ -0,0 +1,29 @@
+<?php
+
+use App\Authority;
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class AddRejectedsAuthorities extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        (new Authority(['name'=>'退货管理-编辑备注','alias_name'=>'退货管理-编辑备注']))->save();
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Authority::where('name','退货管理-编辑备注')->delete();
+    }
+}

+ 2 - 1
resources/views/inventory/statement/changeInventory.blade.php

@@ -64,7 +64,8 @@
                 page:Number('{{$page}}'),
                 owners:[
                     @foreach($owners as $owner)
-                    {name:'{{$owner->customerid}}',value:'{{$owner->descr_c}}'},
+                    {{--{name:'{{$owner->customerid}}',value:'{{$owner->descr_c}}'},--}}
+                    {name:'{{$owner->code}}',value:'{{$owner->name}}'},
                     @endforeach
                 ],
                 checkData:[],

+ 48 - 10
resources/views/rejected/search/general.blade.php

@@ -8,7 +8,7 @@
     </div>
     <div class="container-fluid">
         <div>
-{{--        <div style="min-width: 2070px;">--}}
+            {{--        <div style="min-width: 2070px;">--}}
             <div class="d-none" id="list">
                 @if(Session::has('successTip'))
                     <div class="alert alert-success h1">{{Session::get('successTip')}}</div>
@@ -117,7 +117,15 @@
                                 </tr>
                             </table>
                         </td>
-                        <td class="text-muted" style="max-width: 190px">@{{rejectedBill.remark}}</td>
+                        {{--                        <td class="text-muted" style="max-width: 190px">@{{rejectedBill.remark}}</td>--}}
+                        <td style="min-width:150px;">
+                            @can('退货管理-编辑备注')
+                                <textarea class="form-control form-control-sm"   :rows="rejectedBill.remark?Math.ceil(rejectedBill.remark.length/8):2"  cols=8
+                                          @change="updateRejectedBillRemark($event)" :value="rejectedBill.remark" :data_id="rejectedBill.id">@{{ rejectedBill.remark }}</textarea>
+                            @else
+                                <span>@{{rejectedBill.remark}}</span>
+                            @endcan
+                        </td>
                         <td class="text-muted">@{{rejectedBill.operator_name}}</td>
                         @can('退货管理-编辑')
                             <td>
@@ -149,7 +157,7 @@
             rejectedBill.detailFolding=true;
         })
         let owners=[
-            @foreach($owners as $owner)
+                @foreach($owners as $owner)
             {id:'{{$owner->id}}',name:'{{$owner->name}}'},
             @endforeach
         ];
@@ -185,18 +193,18 @@
                 rejectedBills:rejectedBills,
                 rejectedBills_checkBoxes:[],
                 owners:[
-                    @foreach($owners as $owner)
+                        @foreach($owners as $owner)
                     {name:'{{$owner->id}}',value:'{{$owner->name}}'},
                     @endforeach
                 ],
                 issueIds:{!! $issueIds !!},
                 logistics:[
-                    @foreach($logistics as $logistic)
+                        @foreach($logistics as $logistic)
                     {name:'{{$logistic->id}}',value:'{{$logistic->name}}'},
                     @endforeach
                 ],
                 qualityLabels:[
-                    @foreach($qualityLabels as $qualityLabel)
+                        @foreach($qualityLabels as $qualityLabel)
                     {name:'{{$qualityLabel->id}}',value:'{{$qualityLabel->name}}'},
                     @endforeach
                 ],
@@ -214,6 +222,7 @@
                         {name:'logistic_number',type:'input',tip:'原单单号:可在两侧增加百分号(%)进行模糊搜索',placeholder:'原单单号'},
                         {name:'is_checked',type:'select',placeholder: '是否审核',data:[{name:1,value:'已审核'},{name:0,value:'未审核'}]},
                         {name:'id_logistic_return',type:'select',placeholder: '快递名称',data:this.logistics},
+                        {name:'remark',type:'input',tip:'退单备注:默认查询15天以内记录信息',placeholder: '退单备注'},
                     ],[
                         {name:'created_at_end',type:'dateTime',tip:'选择显示指定日期的结束时间'},
                         {name:'barcode_goods',type:'input',tip:'商品条码:可模糊匹配右边未填完的部分,按回车提交',placeholder:'商品条码'},
@@ -221,7 +230,7 @@
                         {name:'mobile_sender',type:'input',tip:'寄件人手机:输入完成敲回车提交',placeholder:'寄件人手机'},
                         {name:'checked_numbers',type:'input',tip:'审核批次号:支持右位留空的模糊搜索',placeholder:'审核批次号'},
                         {name:'is_loaded',type:'select',placeholder: '是否入库',data:[{name:1,value:'是'},{name:0,value:'否'},
-                        {name:'null',value:'无需入库'},{name:2,value:'待推单'},{name:4,value:'待确认'},{name:3,value:'交互异常'}]},
+                                {name:'null',value:'无需入库'},{name:2,value:'待推单'},{name:4,value:'待确认'},{name:3,value:'交互异常'}]},
                         {name:'is_issue',type:'select',data:[{name:'true',value:'有'},{name:'false',value:'无'}],tip:'问题件',placeholder:'问题件'}
                     ]
                 ];
@@ -291,6 +300,36 @@
                 }
             },
             methods:{
+                updateRejectedBillRemark:function (e) {
+                    let target = $(e.target);
+                    let _this = this;
+                    let id = target.attr('data_id');
+                    let remark = target.val();
+                    let ajaxUrl= '{{url("rejected/changeRejectedBillRemark")}}';
+                    axios.post(ajaxUrl,{'id':id,'remark':remark}).then(function (response) {
+                        if(response.data.success){
+                            _this.updateRejectedBills(id,remark);
+                            tempTip.setDuration(2000);
+                            tempTip.showSuccess('备注修改成功');
+                        }else{
+                            tempTip.setDuration(3000);
+                            tempTip.show('备注修改失败!'+response.data.fail_info);
+                        }
+                    }).catch(function (err) {
+                        tempTip.setDuration(3000);
+                        tempTip.show('备注修改失败!网络异常:'+err);
+                    });
+
+                },
+                // 更新表格数据
+                updateRejectedBills(id,remark){
+                    this.rejectedBills.some(function(rejectedBill){
+                        if(parseInt(rejectedBill.id) === parseInt(id)){
+                            rejectedBill.remark = remark;
+                            return true;
+                        }
+                    })
+                },
                 edit(id){
                     window.location.href=editUrl+id+"/edit";
                     // window.open(editUrl+id+"/edit",'_blank') ;
@@ -372,7 +411,7 @@
                         alert('网络连接错误:'+e);
                         tempTip.setDuration(2500);
                         tempTip.show('审核勾选内容失败,网络连接错误:'+e);
-                        console.log(e);
+
                     });
                     $(e.target).val("")
                 },
@@ -415,7 +454,6 @@
                         alert('网络连接错误:'+e);
                         tempTip.setDuration(2500);
                         tempTip.show('审核勾选内容失败,网络连接错误:'+e);
-                        console.log(e);
                     })
                 },
                 confirmBeStored:function($e,id){
@@ -437,7 +475,7 @@
                         alert('确认失败,网络连接错误:'+e);
                         tempTip.setDuration(2500);
                         tempTip.show('确认失败,网络连接错误:'+e);
-                        console.log(e);
+
                     })
                 },
                 finishAll:function(){

+ 1 - 0
routes/web.php

@@ -182,6 +182,7 @@ Route::group(['prefix'=>'rejected'],function(){
     Route::any('export', 'RejectedController@export');
     Route::any('exportAnalyze', 'RejectedController@exportAnalyze');
     Route::post('ajaxGetRejected', 'RejectedController@ajaxGetRejected');
+    Route::post('changeRejectedBillRemark', 'RejectedController@changeRejectedBillRemark');
 });
 Route::resource('rejected', 'RejectedController');