Procházet zdrojové kódy

Merge branch 'Haozi'

LD před 5 roky
rodič
revize
f332bf01e1

+ 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/Http/Controllers/LaborReportController.php

@@ -271,7 +271,7 @@ class LaborReportController extends Controller
         if(!Gate::allows('人事管理-临时工报表-编辑备注')){return ['success'=>'false','fail_info'=>'没有权限'];}
         $laborReportId = $request->input('id');
         $laborReportRemark = $request->input('remark');
-        if(is_null($laborReportId) or is_null($laborReportRemark)){
+        if(is_null($laborReportId) ){
             return ['success'=>false,'fail_info'=>'参数异常'];
         }
         $laborReport=LaborReport::find($laborReportId);

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

@@ -29,7 +29,6 @@ class UserDutyCheckController extends Controller
     public function importAndExportClock(Request $request)
     {
         $importAndExportQRCodeType = $request->input('importAndExportQRCodeType');
-        $this->log(__METHOD__, "进出场扫码__" . __FUNCTION__, json_encode($importAndExportQRCodeType));
         $qrCode_refresh_everyday = config('hr.qrCode_refresh_everyday');
         $qrCode_refresh = config('hr.qrCode_refresh');
         if ($qrCode_refresh_everyday) {
@@ -47,6 +46,7 @@ class UserDutyCheckController extends Controller
 
         $userLaborToken = $request->cookie('userLaborToken');
         $user_id = Cache::get('dutyCheckTokenStr_'.$userLaborToken);
+        if (!$user_id) $this->log(__METHOD__, "进出场扫码(未绑定设备)__" . __FUNCTION__, json_encode($importAndExportQRCodeType));
         if ($userLaborToken && $user_id) {
             $userDetail = UserDetail::find($user_id);
             if($userDetail){
@@ -60,6 +60,7 @@ class UserDutyCheckController extends Controller
                 $errorMessage = $laborReportService->makeOrChangeLaborReportByUserDutyCheck($userDutyCheck, $importAndExportQRCodeType);
                 if ($errorMessage) return $errorMessage;
                 $laravelEchoPrefix = config('database.redis.options.prefix');
+                $this->log(__METHOD__, "进出场扫码__" . __FUNCTION__, json_encode($importAndExportQRCodeType,$userDetail));
                 return response()->view('personnel/checking-in/importAndExportSuccess', ['full_name' => $userDetail->full_name, 'checked_at' => $userDutyCheck->checked_at, 'type' => $userDutyCheck->type, 'laravelEchoPrefix' => $laravelEchoPrefix]);
 
             }
@@ -281,9 +282,9 @@ class UserDutyCheckController extends Controller
     public function clock(Request $request)
     {
         $userWorkgroupID = $request->input('userWorkgroupID');
-        $this->log(__METHOD__, "进组扫码__" . __FUNCTION__, json_encode($userWorkgroupID));
         $userLaborToken = $request->cookie('userLaborToken');
         $user_id = Cache::get('dutyCheckTokenStr_'.$userLaborToken);
+        if (!$user_id)$this->log(__METHOD__, "进组扫码(未绑定设备)__" . __FUNCTION__, json_encode($userWorkgroupID));
         if ($userLaborToken && $user_id) {
             $dateNow = Carbon::now()->format('Y-m-d');
             $userDutyCheck = UserDutyCheck::where('user_id', $user_id)->where('checked_at', 'like', $dateNow. '%')->orderBy('id', 'desc')->first();
@@ -291,6 +292,7 @@ class UserDutyCheckController extends Controller
             if ($userDutyCheck->type == '登出') return "<h1 style='color: red;text-align:center'>进场是否未打卡?如若未打,请先返回打进场卡!</h1>";
             $html=$this->updateLaborReport($user_id,$userWorkgroupID);
             if ($html)return $html;
+            $this->log(__METHOD__, "进组扫码__" . __FUNCTION__, json_encode($userWorkgroupID,$user_id));
         }else{
             return view("personnel/checking-in/enterGroupClock", compact('userWorkgroupID'));
         }
@@ -336,6 +338,7 @@ class UserDutyCheckController extends Controller
         $userDutyCheck = UserDutyCheck::where('user_id', $userDetail->user_id)->where('checked_at', 'like', $dateNow. '%')->orderBy('id', 'desc')->first();
         if (!$userDutyCheck['verify_user_id']) return "<h1 style='color: red;text-align:center'>进场门卫还未审核,暂无法进组!</h1>";
         if ($userDutyCheck->type == '登出') return "<h1 style='color: red;text-align:center'>进场是否未打卡?如若未打,请先返回打进场卡!</h1>";
+        $this->log(__METHOD__, "进组扫码未绑定设备重新绑定__" . __FUNCTION__, json_encode($userWorkgroupID,$userDetail));
         $html=$this->updateLaborReport($userDetail->user_id,$userWorkgroupID,$userLaborToken);
         if ($html)return $html;
     }

+ 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,

+ 32 - 31
resources/views/inventory/stockInventory/inventoryMission.blade.php

@@ -71,7 +71,9 @@
             @{{ inventory.type }}
         </span>
             <span v-if="!listMode">
-            <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>
+                 @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>
@@ -96,7 +98,6 @@
                 <span class="form-group ml-4" v-if="dataExtraStatus.addingNew" id="countBlock">
                         <label for="count" class="text-secondary font-weight-bold">请输盘点数</label>
                         <input type="text" id="amountInput"  @keypress="amountPress($event)"
-                               @change="amountChange($event)"
                                name="count" class="form-control input" value="@if(old('count')){{old('count')}}@endif"  autocomplete="off">
                     </span>
 
@@ -741,21 +742,11 @@
                     }
                 },
                 barcodeChange(e){
-                    let _this=this;
-                    this.inputs().barcode=e.target.value;
-                    this.放置焦点光标至正确位置();
-                    _this.显示盘点计数input_按情况();
-                    (new Promise(function(resolve,reject){resolve()})).then(function (){
-                        _this.提交库位和条码()
-                        _this.显示盘点计数input_按情况();
-                    })
+                    this.inputs().barcode = e.target.value;
+                    this.提交部分输入();
                 },
                 amountPress(e){
-                    if(e.key==='Enter') this.amountChange(e);
-                },
-                amountChange(e){
-                    this.inputs().amount=e.target.value;
-                    this.提交新增并盘点();
+                    if(e.key==='Enter') this.提交新增(e);
                 },
                 locationPress(e){
                     if(e.key==='Enter'){
@@ -763,21 +754,31 @@
                     }
                 },
                 locationChange(e){
-                    let _this=this;
-                    this.inputs().location=e.target.value;
+                    this.inputs().location = e.target.value;
+                    this.提交部分输入();
+                },
+                提交部分输入:_.throttle(function(){
+                    let _this = this;
                     this.放置焦点光标至正确位置();
                     _this.显示盘点计数input_按情况();
-                    (new Promise(function(resolve,reject){resolve()})).then(function (){
+                    (new Promise(function (resolve, reject) {
+                        resolve()
+                    })).then(function () {
                         _this.提交库位和条码();
                         _this.显示盘点计数input_按情况();
                     })
-                },
+
+                },100,{trailing:false}),
+                提交新增:_.throttle(function(e){
+                    this.inputs().amount=e.target.value;
+                    this.提交新增并盘点();
+                },100,{trailing:false}),
                 selectingRow(e){
                     let _this=this;
                     let id = $(e.target).attr('data_id');
                     _this.selectingId=id;
                     if(e.key==='Enter'){
-                        this.放置焦点光标至正确位置()
+                        this.放置焦点光标至正确位置();
                         let re=true;
                         _this.提交新增并盘点().then(function(result){
                             if(!result){
@@ -927,7 +928,7 @@
                     if(!库位存在于当前记录)新增字段标记='库位新增';
                     if(!条码存在于当前记录)新增字段标记='商品新增';
 
-                    this.增加系统之外的盘点记录(_this.inputs().location,_this.inputs().barcode,_this.inputs().amount,inventoryId,_this.inventory.owner.code,新增字段标记);
+                    _this.增加系统之外的盘点记录(_this.inputs().location,_this.inputs().barcode,_this.inputs().amount,inventoryId,_this.inventory.owner.code,新增字段标记);
                     return true;
                 },
                 提交盘点:_.throttle(function(){
@@ -942,8 +943,10 @@
                                 if (inventoryMission.stockInventoryPersons.length > 0 && inventoryMission.id === _this.selectingId) {
                                     _this.lastStockInventoryRecord = inventoryMission;
                                     _this.stockInventoryPersons = inventoryMission.stockInventoryPersons;
-                                    if (_this.inventory.status !== '复盘中') $("#lastStockInventoryRecord").modal('show');
-                                    return;
+                                    if (_this.inventory.status !== '复盘中'){
+                                        $("#lastStockInventoryRecord").modal('show');
+                                        return;
+                                    }
                                 }
                                 _this.盘点(选定盘点记录id,库位,条码,_this.inventory.id,盘点数);
                                 _this.清空指定盘点记录列();
@@ -955,9 +958,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);
@@ -1038,12 +1039,14 @@
                     _this.未复盘有差异列 = _this.按库位排序_且合并SKU一起(_this.未复盘有差异列);
                     _this.已复盘无差异列 = _this.按库位排序_且合并SKU一起(_this.已复盘无差异列);
                     _this.无差异列 = _this.按库位排序_且合并SKU一起(_this.无差异列);
+
                     _this.未盘列 = _this.按库位排序_且合并SKU一起(_this.未盘列);
-                    if (!_this.分割位置id) _this.分割位置id = _this.未盘列[0].id;
+                    if (_this.未盘列.length>0&&!_this.分割位置id) _this.分割位置id = _this.未盘列[0].id;
                     _this.分割位置id = _this.更新分割位置(_this.未盘分隔列2, _this.分割位置id);
                     _this.未盘分隔列 = _this.分隔_基于分割位置(_this.未盘列, _this.分割位置id);
                     _this.未盘分隔列1 = _this.按库位排序_且合并SKU一起(_this.未盘分隔列[0]);
                     _this.未盘分隔列2 = _this.按库位排序_且合并SKU一起(_this.未盘分隔列[1]);
+
                     _this.跳过列 = _this.按库位排序_且合并SKU一起(_this.跳过列);
                     _this.inventoryMissions = [];
                     _this.重推入(_this.inventoryMissions, _this.已复盘有差异列);
@@ -1170,9 +1173,8 @@
                 跳过盘点记录(inventoryAccountMissionId, inventoryAccountId, name) {
                     let _this = this;
                     if (!confirm('确定要跳过商品为:“' + name + '”的盘点记录吗?')) {
-                        return
+                        return ;
                     }
-                    ;
                     let url = '{{url('inventory/跳过盘点记录')}}';
                     axios.post(url, {
                         inventoryAccountMissionId: inventoryAccountMissionId,
@@ -1202,9 +1204,8 @@
                 完结盘点任务(id, owner_name, type) {
                     let _this = this;
                     if (!confirm('确定完结货主为:“' + owner_name + '”的“' + type + '”任务吗?')) {
-                        return
+                        return;
                     }
-                    ;
                     let url = '{{url('inventory/完结盘点任务')}}/' + id;
                     axios.get(url).then(function (response) {
                         if (!response.data.success) {

+ 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>