浏览代码

库存盘点--增加局部盘点并为盘点任务表添加备注字段

haozi 5 年之前
父节点
当前提交
c700e71f2a

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

@@ -83,7 +83,7 @@ class InventoryAccountController extends Controller
         $stockInventoryPersons=$inventoryAccountMission->stockInventoryPersons;
         return ['success'=>true,'inventoryMission'=>$inventoryAccountMission,'inventory'=>$inventoryAccount,'stockInventoryPersons'=>$stockInventoryPersons];
     }
-    //根据该库存和产品条码查询该条盘点记录
+    //根据该库存和产品条码查询该条盘点记录??
     public function searchStockInventoryRecord(Request $request){
         if (!Gate::allows('库存管理-盘点')){return redirect(url('/')); }
         $location=$request->input('location');
@@ -147,7 +147,7 @@ class InventoryAccountController extends Controller
         return Excel::download(new Export($row,$list),date('YmdHis', time()).'-盘点任务记录单.xlsx');
     }
     public function stockInventoryEnd(Request $request){
-        if (!Gate::allows('库存管理-盘点-结束初盘')){return redirect(url('/')); }
+        if (!Gate::allows('库存管理-盘点-结束初盘')){return ['success'=>false,'data'=>'没有权限']; }
         $id=$request->input('id');
         if (!$id) return ['success'=>false,'data'=>'参数错误!'];
         $inventoryAccount=InventoryAccount::query()->where('id',$id)->update(['status'=>'复盘中']);

+ 1 - 1
app/InventoryAccount.php

@@ -12,7 +12,7 @@ class InventoryAccount extends Model
     use ModelTimeFormat;
     use SoftDeletes;
     protected $fillable=[
-        'id','owner_id','type', 'start_at', 'end_at','total','processed','difference','returned','deleted_at','created_at','status',
+        'id','owner_id','type', 'start_at', 'end_at','total','processed','difference','returned','deleted_at','created_at','status','remark',
     ];
     protected $appends = [
             'surplus','check_surplus'

+ 8 - 5
app/Services/InventoryAccountService.php

@@ -245,20 +245,23 @@ class InventoryAccountService
         if (!$ownerId) return null;
         if ($date_start&&$date_end){
             $date_end_time=$date_end.' 23:59:59';
-            $type='动盘';
+            if ($location||$barcode)$type='局部盘点';
+            if (!$location&&!$barcode)$type='动盘';
             $wmsInventories=$this->conditionPortStock($date_start,$date_end,$ownerId,$location,$barcode);
-        }elseif (!$date_start&&!$date_end){
+        }
+        if (!$date_start&&!$date_end){
             $name=Owner::where('id',$ownerId)->value('name');
             $ownerName=OracleBasCustomer::where('customer_type','OW')->where('active_flag','Y')->where('descr_c',$name)->value('customerid');
             $date_start=OracleInvLotLocId::where('customerid',$ownerName)->orderBy('addtime','ASC')->value('addtime');
             $date_end_time=OracleInvLotLocId::where('customerid',$ownerName)->orderBy('addtime','DESC')->value('addtime');
-            $type='全盘';
+            if ($location||$barcode)$type='局部盘点';
+            if (!$location&&!$barcode)$type='全盘';
             $wmsInventories=$this->conditionTotalStock($ownerId,$location,$barcode);
-        }else{
-            return null;
         }
+
         $inventory=new InventoryAccount([
             'owner_id'=>$ownerId,
+            'remark'=>$location,
             'type'=>$type,
             'start_at'=>$date_start,
             'end_at'=>$date_end_time,

+ 3 - 3
resources/views/inventory/stockInventory/inventoryMission.blade.php

@@ -71,7 +71,9 @@
             @{{ inventory.type }}
         </span>
             <span v-if="!listMode">
+                 @can('库存管理-盘点-结束初盘')
             <span v-if="inventory.status==='盘点中' ||inventory.status=='待盘点'" class="btn  col-md-2 font-weight-bold btn-outline-secondary" style="max-width: 160px" @click="stockInventoryEnd(inventory.id)">结束</span>
+                @endcan
             <span v-if="inventory.status==='复盘中'" class="btn  col-md-2 font-weight-bold" style="cursor: default;max-width: 160px" :class="inventory.status=='盘点中' ||inventory.status=='待盘点'?'btn-outline-info disabled':'bg-info'">复盘</span>
         </span>
         </div>
@@ -955,9 +957,7 @@
                 stockInventoryEnd(id) {
                     let _this = this;
                     let url = '{{url('inventory/stockInventoryEnd')}}';
-                    if (!confirm('确定要结束初盘任务,进入复盘吗?')) {
-                        return
-                    }
+                    if (!confirm('确定要结束初盘任务,进入复盘吗?')) {return;}
                     axios.post(url, {id: id}).then(function (response) {
                         if (!response.data.success) {
                             tempTip.setDuration(2000);

+ 16 - 7
resources/views/inventory/stockInventory/mission.blade.php

@@ -17,12 +17,13 @@
             <span class="form-inline">
                 <input type="date" @change="hasDateStart" class="form-control form-control-sm ml-5 tooltipTarget" name="date_start" id="date_start"  title="选择创建日期的开始时间" style="width: 150px">
                 <input type="date" @change="hasDateEnd" class="form-control form-control-sm ml-5 tooltipTarget" name="date_end" id="date_end"  title="选择创建日期的结束时间" style="width: 150px">
-                <input type="text"  class="form-control form-control-sm ml-5 tooltipTarget" name="location" id="location"  title="选择创建盘点任务库位的前缀字母" placeholder="库位前缀字母" style="width: 150px" autocomplete="off">
-                <input type="text"  class="form-control form-control-sm ml-5 tooltipTarget" name="barcode" id="barcode"  title="商品条码,糊模查找需要在左边打上%符号" placeholder="条码" style="width: 200px" autocomplete="off">
+                <input type="text" @change="hasLocation" class="form-control form-control-sm ml-5 tooltipTarget" name="location" id="location"  title="选择创建盘点任务库位的前缀字母" placeholder="库位前缀字母" style="width: 150px" autocomplete="off">
+                <input type="text" @change="hasBarcode" class="form-control form-control-sm ml-5 tooltipTarget" name="barcode" id="barcode"  title="商品条码,糊模查找需要在左边打上%符号" placeholder="条码" style="width: 200px" autocomplete="off">
             </span>
             <span class="ml-5">
             @can('库存管理-盘点')
-                    <span v-if="date_start&&date_end" class="btn btn-sm  btn-outline-secondary tooltipTarget" @click="createInventoryMission" title="选择单一指定货主生成盘点任务">生成动盘任务</span>
+                    <span v-if="date_start&&date_end&&!location&&!barcode" class="btn btn-sm  btn-outline-secondary tooltipTarget" @click="createInventoryMission" title="选择单一指定货主生成盘点任务">生成动盘任务</span>
+                    <span v-else-if="location||barcode ||(date_start&&date_end&&location)||(date_start&&date_end&&barcode)" class="btn btn-sm  btn-outline-secondary tooltipTarget" @click="createInventoryMission" title="选择单一指定货主生成盘点任务">生成局部盘点任务</span>
                     <span v-else class="btn btn-sm btn-outline-secondary  tooltipTarget" @click="createInventoryMission" title="选择单一指定货主生成盘点任务">生成全盘任务</span>
                 @endcan
             </span>
@@ -55,7 +56,10 @@
                     <td >@{{ inventory.id }}</td>
                     <td >@{{ inventory.created_at }}</td>
                     <td >@{{ inventory.owner_name }}</td>
-                    <td >@{{ inventory.type }}</td>
+                    <td >
+                        @{{ inventory.type }}
+                        <span v-if="inventory.remark">/@{{ inventory.remark }}</span>
+                    </td>
                     <td >@{{ inventory.start_at }}</td>
                     <td class="text-muted">@{{ inventory.end_at }}</td>
                     <td >@{{ inventory.total }}</td>
@@ -103,7 +107,7 @@
                         returned:'{{$inventory->returned}}', surplus:'{{$inventory->surplus}}',
                         total:'{{$inventory->total}}',end_at:'{{$inventory->end_at}}',
                         start_at:'{{$inventory->start_at}}',type:'{{$inventory->type}}',
-                        difference:'{{$inventory->difference}}'},
+                        difference:'{{$inventory->difference}}', remark:'{{$inventory->remark}}'},
                     @endforeach
                 ],
                 owners:{!! $owners !!},
@@ -111,8 +115,7 @@
                 selectedStyle:'',
                 sum:{!! $inventoryAccounts->total() !!},
                 // formData:{},
-                date_end:'',
-                date_start:'',
+                date_end:'',location:'',barcode:'', date_start:'',
                 fakeOwners:'',
             },
             mounted: function () {
@@ -315,6 +318,12 @@
                 hasDateEnd(){
                     this.date_end=document.getElementById('date_end').value;
                 },
+                hasLocation(){
+                    this.location=$('#location').val().trim();
+                },
+                hasBarcode(){
+                    this.barcode=$('#barcode').val();
+                },
             }
         });
     </script>