瀏覽代碼

Merge branch 'master' into zengjun

ajun 5 年之前
父節點
當前提交
da439f40ac
共有 31 個文件被更改,包括 937 次插入194 次删除
  1. 5 1
      app/Console/Commands/InventoryDailyLoggingOwner.php
  2. 18 18
      app/Console/Commands/WASSyncWMSOrderInformation.php
  3. 27 5
      app/Http/Controllers/InventoryAccountController.php
  4. 1 1
      app/Http/Controllers/LaborReportController.php
  5. 1 1
      app/Http/Controllers/StoreCheckingReceiveController.php
  6. 10 6
      app/Http/Controllers/UserDutyCheckController.php
  7. 1 1
      app/Http/Controllers/WaybillController.php
  8. 62 0
      app/Http/Controllers/api/thirdPart/haiq/StorageController.php
  9. 1 1
      app/InventoryAccount.php
  10. 1 1
      app/InventoryDailyLog.php
  11. 46 18
      app/Services/InventoryAccountService.php
  12. 4 3
      app/Services/InventoryCompareService.php
  13. 4 0
      app/Services/LaborReportService.php
  14. 4 0
      app/Services/OwnerService.php
  15. 1 1
      app/Services/WaybillService.php
  16. 7 0
      config/api.php
  17. 29 0
      database/migrations/2020_09_24_152015_change_labor_report_status.php
  18. 32 0
      database/migrations/2020_09_25_141059_change_inventory_daily_logs_add_gross_weight.php
  19. 0 3
      laravel-echo-server.lock
  20. 5 10
      public/t.php
  21. 5 3
      resources/js/utilities/tempTip.js
  22. 6 3
      resources/views/inventory/statement/dailyLog.blade.php
  23. 525 0
      resources/views/inventory/stockInventory/blindReceive.blade.php
  24. 102 102
      resources/views/inventory/stockInventory/inventoryMission.blade.php
  25. 24 9
      resources/views/inventory/stockInventory/mission.blade.php
  26. 1 1
      resources/views/layouts/app.blade.php
  27. 2 2
      resources/views/process/create.blade.php
  28. 2 2
      resources/views/store/checkingReceive/mission.blade.php
  29. 8 0
      resources/views/store/index.blade.php
  30. 2 1
      routes/web.php
  31. 1 1
      webpack.mix.js

+ 5 - 1
app/Console/Commands/InventoryDailyLoggingOwner.php

@@ -49,7 +49,7 @@ class InventoryDailyLoggingOwner extends Command
         if ($let == 0)return;
         //拼接SQL,SELECT仅取指定字段
         $sql = "SELECT INV_LOT.customerid,INV_LOT.sku,INV_LOT.qty,BAS_SKU.skulength,
-                BAS_SKU.skuwidth,BAS_SKU.skuhigh,BAS_SKU.cube,BAS_SKU.descr_c,BAS_SKU.alternate_sku1
+                BAS_SKU.skuwidth,BAS_SKU.skuhigh,BAS_SKU.cube,BAS_SKU.descr_c,BAS_SKU.alternate_sku1,BAS_SKU.grossweight
                 FROM INV_LOT
                 LEFT JOIN BAS_SKU ON INV_LOT.sku = BAS_SKU.sku AND INV_LOT.customerid = BAS_SKU.customerid
                 WHERE INV_LOT.customerid IN (";
@@ -80,9 +80,11 @@ class InventoryDailyLoggingOwner extends Command
                         'height'=>$invLot->skuhigh,
                         'volumn'=>$invLot->cube,
                         'code'=>$invLot->alternate_sku1,
+                        'weight' => $invLot->grossweight,
                     ],
                     'amount' => $invLot->qty,
                     'volumn_occupied' => 0,
+                    'gross_weight' => 0,
                 ];
             }
         }
@@ -113,12 +115,14 @@ class InventoryDailyLoggingOwner extends Command
             if ($commodity['code']) CommodityBarcode::query()->firstOrCreate(['commodity_id'=>$commodity_id,'code'=>$commodity['code']]);
             //计算总体积,商品体积×该单数量
             $volumn_occupied = $commodity['volumn']*$inventoryDailyLog["amount"];
+            $gross_weight = $commodity['weight']*$inventoryDailyLog["amount"];
             array_push($data,[
                 "owner_id"=>$commodity['owner_id'],
                 "created_at"=>date('Y-m-d H:i:s'),
                 "commodity_id"=>$commodity_id,
                 "amount"=>$inventoryDailyLog['amount'],
                 "volumn_occupied"=>$volumn_occupied,
+                "gross_weight"=>$gross_weight,
             ]);
         }
         DB::table('inventory_daily_logs')->insert($data);

+ 18 - 18
app/Console/Commands/WASSyncWMSOrderInformation.php

@@ -47,24 +47,24 @@ class WASSyncWMSOrderInformation extends Command
 
     public function WasSyncWmsOrder(){
 
-        /** @var OrderTrackingService $orderTrackingService */
-        $orderTrackingService  = app('orderTrackingService');
-
-        $dataInterval = intval(data_get(config('sync'), 'order_tracking_import.interval')) * 60 + 5;
-
-        $startDate = Carbon::now()->subSeconds($dataInterval);
-
-        $syncStartDate = data_get(config('sync'), 'order_tracking_import.start_at');
-
-        if($syncStartDate ?? false){
-            $syncStartDate = Carbon::parse($syncStartDate);
-            if ($startDate->lt($syncStartDate)) {
-                $startDate = $syncStartDate;
-            }
-        }
-
-//        $startDate = Carbon::parse('2020-05-06 13:16:51')->toDateTimeString();
-        $orderTrackingService->根据设置从WMS同步追踪货主的订单($startDate);
+//        /** @var OrderTrackingService $orderTrackingService */
+//        $orderTrackingService  = app('orderTrackingService');
+//
+//        $dataInterval = intval(data_get(config('sync'), 'order_tracking_import.interval')) * 60 + 5;
+//
+//        $startDate = Carbon::now()->subSeconds($dataInterval);
+//
+//        $syncStartDate = data_get(config('sync'), 'order_tracking_import.start_at');
+//
+//        if($syncStartDate ?? false){
+//            $syncStartDate = Carbon::parse($syncStartDate);
+//            if ($startDate->lt($syncStartDate)) {
+//                $startDate = $syncStartDate;
+//            }
+//        }
+//
+////        $startDate = Carbon::parse('2020-05-06 13:16:51')->toDateTimeString();
+////        $orderTrackingService->根据设置从WMS同步追踪货主的订单($startDate);
 //        $orderTrackingService->trackingWmsOrder($startDate);
     }
 }

+ 27 - 5
app/Http/Controllers/InventoryAccountController.php

@@ -56,14 +56,18 @@ class InventoryAccountController extends Controller
     }
     //进入盘点中或复盘页面
     public function enterStockInventory($id,Request $request){
-        if (!Gate::allows('库存管理-盘点-查看')&&!Gate::allows('库存管理-盘点')){return redirect(url('/')); }
+        if (!Gate::allows('库存管理-盘点')){return redirect(url('/')); }
         if (!$id) return ['success'=>false,'data'=>'参数错误!'];
         $inventoryAccount=InventoryAccount::with('owner')->find($id);
         $inventoryAccountMissions=InventoryAccountMission::with(['commodity.barcodes','stockInventoryPersons'])->where('inventory_account_id',$id)->orderBy('difference_amount','desc')->get();
-
         return view('inventory.stockInventory.inventoryMission',compact('inventoryAccount','inventoryAccountMissions'));
     }
-
+    public function enterBlindReceive($id){
+        if (!Gate::allows('库存管理-盘点')){return redirect(url('/')); }
+        if (!$id) return ['success'=>false,'data'=>'参数错误!'];
+        $inventoryAccount=InventoryAccount::with('owner')->find($id);
+        return view('inventory.stockInventory.blindReceive',compact('inventoryAccount'));
+    }
     //依据盘点任务id进行 --盘点
     public function stockInventory(Request $request){
         if (!Gate::allows('库存管理-盘点')){return redirect(url('/')); }
@@ -83,7 +87,25 @@ class InventoryAccountController extends Controller
         $stockInventoryPersons=$inventoryAccountMission->stockInventoryPersons;
         return ['success'=>true,'inventoryMission'=>$inventoryAccountMission,'inventory'=>$inventoryAccount,'stockInventoryPersons'=>$stockInventoryPersons];
     }
-    //根据该库存和产品条码查询该条盘点记录
+    public function baseOnBlindReceive(Request $request){
+        if (!Gate::allows('库存管理-盘点')){return redirect(url('/')); }
+        $location=$request->input('location');
+        $inventoryId=$request->input('inventoryId');
+        $owner_code=$request->input('owner_code');
+        $goodses=$request->input('goodses');
+        if (!$location) return ['success'=>false,'fail_info'=>'盘点库位不存在!'];
+        if (count($goodses)<1) return ['success'=>false,'fail_info'=>'盘点商品不存在!'];
+        //dd($location,$owner_code,$goodses,$inventoryId,$owner_id);
+        /** @var InventoryAccountService $inventoryAccountMission */
+        $inventoryAccountService=app('inventoryAccountService');
+        $inventoryAccountMissions=$inventoryAccountService->baseOnBlindReceive($location,$owner_code,$goodses,$inventoryId);
+        if (count($inventoryAccountMissions)<0)return ['success'=>false,'fail_info'=>'盲收盘点失败!'];
+        /** @var InventoryAccountService $inventoryService */
+        $inventoryService=app('inventoryAccountService');
+        $inventoryAccount=$inventoryService->updateInventory($inventoryId);
+        if ($inventoryAccountMissions&&$inventoryAccount) return ['success'=>true,'status'=>'盲收盘点成功'];
+    }
+    //根据该库存和产品条码查询该条盘点记录??
     public function searchStockInventoryRecord(Request $request){
         if (!Gate::allows('库存管理-盘点')){return redirect(url('/')); }
         $location=$request->input('location');
@@ -147,7 +169,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);

+ 1 - 1
app/Http/Controllers/StoreCheckingReceiveController.php

@@ -18,7 +18,7 @@ use Maatwebsite\Excel\Facades\Excel;
 class StoreCheckingReceiveController extends Controller
 {
     public function mission(Request $request){
-        if(!Gate::allows('入库管理-盘收一体-盘收-查看')){ return redirect(url('/'));  }
+        if(!Gate::allows('入库管理-盘收一体-盘收-查看')){ return view('store/index');  }
         /** @var StoreCheckingReceiveService $service */
         $service = app('storeCheckingReceiveService');
 

+ 10 - 6
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]);
 
             }
@@ -95,7 +96,7 @@ class UserDutyCheckController extends Controller
     public function importAndExportDutyCheck($user_id,$importAndExportQRCodeType)
     {
         $dateNow = Carbon::now()->format('Y-m-d');
-        $userDutyCheckOld = UserDutyCheck::where('user_id', $user_id)->where('checked_at','like',$dateNow.'%')->orderBy('id','desc')->limit(10)->first();
+        $userDutyCheckOld = UserDutyCheck::query()->with('laborReport')->where('user_id', $user_id)->where('checked_at','like',$dateNow.'%')->orderBy('id','desc')->first();
         $date = date('Y-m-d H:i:s');
         $this->log(__METHOD__, "提交打卡记录__" . __FUNCTION__, json_encode([$user_id, $date]));
         $userDutyCheck = new UserDutyCheck([
@@ -107,7 +108,7 @@ class UserDutyCheckController extends Controller
         if (!$userDutyCheckOld) {
             //当前日期的前一天
             $yesterday = Carbon::yesterday()->format('Y-m-d');
-            $userDutyCheckYesterday = UserDutyCheck::where('user_id', $user_id)->where('checked_at','like', $yesterday.'%')->orderBy('id','desc')->limit(10)->first();
+            $userDutyCheckYesterday = UserDutyCheck::query()->with('laborReport')->where('user_id', $user_id)->where('checked_at','like', $yesterday.'%')->orderBy('id','desc')->first();
             if ($importAndExportQRCodeType && $importAndExportQRCodeType == 'export') {
                 if ($userDutyCheckYesterday && $userDutyCheckYesterday->type == '登入') {
                     $userDutyCheck->verify_user_id = $userDutyCheckYesterday->verify_user_id;
@@ -117,7 +118,7 @@ class UserDutyCheckController extends Controller
                 }
             }
             if ($importAndExportQRCodeType && $importAndExportQRCodeType == 'import') {
-                if ($userDutyCheckYesterday && $userDutyCheckYesterday->type == '登入') {
+                if ($userDutyCheckYesterday && $userDutyCheckYesterday->type == '登入'&&$userDutyCheckYesterday->laborReport) {
                     $userDutyCheck->import = true;//已入场的不能再入场
                     return $userDutyCheck;
                 }
@@ -131,8 +132,9 @@ class UserDutyCheckController extends Controller
             $this->log(__METHOD__, "创建打卡记录" . __FUNCTION__, json_encode($userDutyCheck));
             return $userDutyCheck;
         }
+
         if ($importAndExportQRCodeType && $importAndExportQRCodeType == 'import') {
-            if ($userDutyCheckOld->type == '登入') {
+            if ($userDutyCheckOld->type == '登入'&&$userDutyCheckOld->laborReport) {
                 $userDutyCheck->import = true;//已入场的不能再入场
                 return $userDutyCheck;
             }
@@ -281,9 +283,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 +293,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 +339,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/Http/Controllers/WaybillController.php

@@ -605,7 +605,7 @@ class WaybillController extends Controller
             'carrier_weight_other'=>'重量',
         ])->errors();
         if (count($errors)>0)return ["errors"=>$errors];
-        $waybill=Waybill::find($request->input('id'));
+        $waybill=Waybill::query()->find($request->input('id'));
         if (!$waybill)return ["error"=>"未找到该运单!"];
         $waybill->fill($request->input());
         $waybill->update();

+ 62 - 0
app/Http/Controllers/api/thirdPart/haiq/StorageController.php

@@ -0,0 +1,62 @@
+<?php
+
+
+namespace App\Http\Controllers\api\thirdPart\haiq;
+
+
+use App\Services\LogService;
+use Illuminate\Support\Facades\Http;
+use Illuminate\Support\Facades\Request;
+
+class StorageController
+{
+    public function out(Request $request){
+        $bin = json_encode([
+            "taskCode" => "",
+            "binCode" => "",
+            "sequence" => 0,
+            "fromLocCode" => "",
+            "toLocCode" => "",
+        ],JSON_UNESCAPED_UNICODE);
+        $req = [
+            "groupCode" => 0,
+            "priority" => 0,
+            "taskMode" => 0,
+            "emptyBinQty" => 0,
+            "toWorkStations" => [""],
+            "bins" => [$bin],
+        ];
+
+        $req = json_encode($req, JSON_UNESCAPED_UNICODE);
+        $response = Http::post(config('api.haiq.storage.out'));
+        $msg = "haiq-料箱出库成功";
+        if ($response["code"] != 200){
+            $msg = "haiq-料箱出库失败";
+        }
+        LogService::log(__METHOD__,$msg,"REQUEST:".$req." | RESPONSE:".json_encode($response,JSON_UNESCAPED_UNICODE));
+    }
+    public function in(Request $request){
+        $stockInfo = json_encode([
+            "skuCode" => "",
+            "qty" => 0,
+        ]);
+        $req = [
+            "taskCode" => "",
+            "taskMode" => 0,
+            "binCode" => "",
+            "fromWorkStation" => "",
+            "fromLocCode" => "",
+            "toLocCode" => "",
+            "isEmpty" => 0,
+            "stockInfo" => [$stockInfo],
+        ];
+
+        $req = json_encode($req, JSON_UNESCAPED_UNICODE);
+        $response = Http::post(config('api.haiq.storage.in'));
+        $msg = "haiq-料箱回库成功";
+        if ($response["code"] != 200){
+            $msg = "haiq-料箱回库失败";
+        }
+        LogService::log(__METHOD__,$msg,"REQUEST:".$req." | RESPONSE:".json_encode($response,JSON_UNESCAPED_UNICODE));
+    }
+}

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

+ 1 - 1
app/InventoryDailyLog.php

@@ -8,7 +8,7 @@ class InventoryDailyLog extends Model
 {
     public $timestamps=false;
     protected $fillable=[
-        'owner_id','created_at','commodity_id','amount','volumn_occupied'
+        'owner_id','created_at','commodity_id','amount','volumn_occupied','gross_weight'
     ];
 
     public function owner(){

+ 46 - 18
app/Services/InventoryAccountService.php

@@ -38,7 +38,8 @@ class InventoryAccountService
             ->sql();
     }
     private function conditionQuery($queryParam){
-        $inventories=InventoryAccount::query()->with(['owner','creator'])->orderBy('id','desc');
+        $ownerIds=app('ownerService')->getSelectionId();
+        $inventories=InventoryAccount::query()->with(['owner','creator'])->orderBy('id','desc')->whereIn('owner_id',$ownerIds);
         $columnQueryRules=[
             'owner_id' => ['multi' => ','],
             'date_start' => ['alias' => 'created_at' , 'startDate' => ' 00:00:00'],
@@ -163,7 +164,7 @@ class InventoryAccountService
                 $sql.=",'".$str."'";
             }
             $sql.=")";
-                $sql.=")";
+            $sql.=")";
         }
         return $sql;
     }
@@ -200,7 +201,7 @@ class InventoryAccountService
                 $sql.=",'".$str."'";
             }
             $sql.=")";
-                $sql.=")";
+            $sql.=")";
         }
         return $sql;
     }
@@ -245,20 +246,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,
@@ -372,11 +376,6 @@ class InventoryAccountService
     //盘点库存
     public function stockInventory($id,$location,$barcode,$count,$inventoryAccountId){
         $inventoryAccountMission=InventoryAccountMission::with(['commodity.barcodes','stockInventoryPersons'])->find($id);
-//        $inventoryAccountMission=InventoryAccountMission::with(['commodity.barcodes','stockInventoryPersons'])->whereHas('commodity',function($query)use($barcode){
-//            $query->whereHas('barcodes',function($sql)use($barcode){
-//                $sql->where('code','=',$barcode);
-//            });
-//        })->where('location',$location)->where('inventory_account_id',$inventoryAccountId)->first();
         $this->盘点($inventoryAccountId,$count,$inventoryAccountMission);
         $request=[
             'location'=>$location,
@@ -458,8 +457,8 @@ class InventoryAccountService
             $commodity->newBarcode($barcode);
         }
         $commodity=Commodity::query()->whereHas('barcodes',function ($query)use($barcode){
-                $query->where('code',$barcode);
-            })->orderBy('id','DESC')->first();
+            $query->where('code',$barcode);
+        })->orderBy('id','DESC')->first();
 
         $inventoryAccountMission=new InventoryAccountMission();
         $inventoryAccountMission->location=$location;
@@ -576,6 +575,7 @@ class InventoryAccountService
         }
         $inventoryAccountMission->update();
         $inventoryAccountMission->createSignStockInventoryPersons();
+        return $inventoryAccountMission;
     }
     public function 删除盘点记录($inventoryAccountMissionId,$inventoryAccountId){
         $inventoryAccountMission=InventoryAccountMission::query()->where('id',$inventoryAccountMissionId)->delete();
@@ -612,11 +612,39 @@ class InventoryAccountService
             ->orWhere('ALTERNATE_SKU2',$barcode)
             ->orWhere('ALTERNATE_SKU3',$barcode)
             ->where('customerid',$owner_code)->first();
-        if ($oracleBasSku){
+            if (!$oracleBasSku)return null;
             return $oracleBasSku;
-        }else{
-            return null;
+    }
+    public function baseOnBlindReceive($location,$owner_code,$goodses,$inventoryId){
+        $request=[
+            'location'=>$location,
+            'owner_code'=>$owner_code,
+            'goodses'=>$goodses,
+            'inventoryId'=>$inventoryId,
+        ];
+        LogService::log(__METHOD__,"盘点基于盲收",json_encode($request));
+        $inventoryAccountMissions=[];
+        foreach ($goodses as $good){
+            $barcode=$good['barcode']??'';
+            $amount=$good['amount']??'';
+            $inventoryAccountMission=InventoryAccountMission::with(['commodity.barcodes','stockInventoryPersons'])->whereHas('commodity',function($query)use($barcode){
+                $query->whereHas('barcodes',function($sql)use($barcode){
+                    $sql->where('code','=',$barcode);
+                });
+            })->where('location',$location)->where('inventory_account_id',$inventoryId)->first();
+            if (!$inventoryAccountMission){
+                $oracleBasSku=$this->searchCommodityByBarcode($barcode,$owner_code);
+                if ($oracleBasSku){
+                    $param='商品新增';
+                    $inventoryAccountMission=$this->增加系统之外的盘点记录($location,$barcode,$inventoryId,$amount,$owner_code,$param);
+                }
+            }else{
+                $inventoryAccountMission=$this->盘点($inventoryId,$amount,$inventoryAccountMission);
+            }
+            array_push($inventoryAccountMissions,$inventoryAccountMission);
         }
+        if (count($inventoryAccountMissions)<1) return null;
+            return $inventoryAccountMissions;
     }
 
 }

+ 4 - 3
app/Services/InventoryCompareService.php

@@ -146,19 +146,20 @@ class InventoryCompareService
         return $inventoryCompares;
     }
     private function conditionQueryInventoryCompare(array $param){
+        $ownerIds=app('ownerService')->getSelectionId();
         $differ=$param['differ']??'';
         if ($differ=='有'){
             $inventoryCompares = InventoryCompare::query()->with(['owner','commodity'=>function($query){
                 $query->with('barcodes');
-            }])->where('differ','>',0)->orderByDesc('id');
+            }])->where('differ','>',0)->orderByDesc('id')->whereIn('owner_id',$ownerIds);
         }elseif ($differ=='无'){
             $inventoryCompares = InventoryCompare::query()->with(['owner','commodity'=>function($query){
                 $query->with('barcodes');
-            }])->where('differ','<',0)->orderByDesc('id');
+            }])->where('differ','<',0)->orderByDesc('id')->whereIn('owner_id',$ownerIds);
         }else{
             $inventoryCompares = InventoryCompare::query()->with(['owner','commodity'=>function($query){
                 $query->with('barcodes');
-            }])->orderByDesc('id');
+            }])->orderByDesc('id')->whereIn('owner_id',$ownerIds);
         }
         unset($param['differ']);
         $columnQueryRules=[

+ 4 - 0
app/Services/LaborReportService.php

@@ -207,6 +207,10 @@ class LaborReportService
     }
     public function 删除($id){
         $laborReport=LaborReport::query()->where('id',$id)->delete();
+        if ($laborReport>0)LaborReportStatus::create([
+           'labor_report_id'=>$id,
+           'status'=>'已删除',
+        ]);
         Controller::logS(__METHOD__,'删除盘点记录时修改盘点任务信息'.__FUNCTION__,json_encode($id));
         return $laborReport;
     }

+ 4 - 0
app/Services/OwnerService.php

@@ -17,6 +17,10 @@ Class OwnerService
     {
         return Owner::filterAuthorities()->select($column)->get();
     }
+    public function getSelectionId($column = ['id'])
+    {
+        return Owner::filterAuthorities()->select($column)->get();
+    }
     /**
      *同步WMS全部货主至WAS
      */

+ 1 - 1
app/Services/WaybillService.php

@@ -101,7 +101,7 @@ Class WaybillService
         $waybill = $this->find($id);
         //替换换行符
         if ($request->dispatch_remark) {
-            $request->offsetSet('dispatch_remark', str_replace(PHP_EOL, ' ', $request->dispatch_remark));
+            $request->offsetSet('dispatch_remark', str_replace(["\n","\r"], ' ', $request->dispatch_remark));
         }
         if (!$request->destination) $request->offsetSet('destination', $waybill->destination);
         if ($request->destination_city_id && $waybill->destination_city_id != $request->destination_city_id) {

+ 7 - 0
config/api.php

@@ -29,6 +29,13 @@ return [
         ],
     ],
 
+    'haiq'=>[
+        'storage'=>[
+            'out' => "",
+            'in' => "",
+        ],
+    ],
+
     'baidu'=>[
         'speech'=>[
             'APP_ID'=> '18688250',

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

@@ -0,0 +1,29 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\DB;
+use Illuminate\Support\Facades\Schema;
+
+class ChangeLaborReportStatus extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        DB::statement("ALTER TABLE labor_report_statuses MODIFY COLUMN status enum ('未审核','已入场','已退场','已换组','已退组','已删除') default '未审核'");
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        DB::statement("ALTER TABLE labor_report_statuses MODIFY COLUMN status enum ('未审核','已入场','已退场','已换组','已退组') default '未审核'");
+    }
+}

+ 32 - 0
database/migrations/2020_09_25_141059_change_inventory_daily_logs_add_gross_weight.php

@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class ChangeInventoryDailyLogsAddGrossWeight extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('inventory_daily_logs', function (Blueprint $table) {
+            $table->decimal('gross_weight',11,3)->nullable()->comment('毛重');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('inventory_daily_logs', function (Blueprint $table) {
+            $table->dropColumn('gross_weight');
+        });
+    }
+}

+ 0 - 3
laravel-echo-server.lock

@@ -1,3 +0,0 @@
-{
-	"process": 14752
-}

+ 5 - 10
public/t.php

@@ -1,14 +1,9 @@
 <script>
 
 
-    let promise = new Promise(function (resolve, reject) {
-
-        resolve('xxx')
-    });
-    promise.then(function(ind){for (let i = 0; i < 9999999; i++) {
-        if (i % 5000 === 0) console.log('i')
-    }})
-    console.log('yes')
-    console.log('yes')
-    console.log('yes')
+    let arr=[a:111,b:222]
+    arr['c']=333;
+    arr['c']=333;
+    arr['c']=333;
+    console.log(Array.isArray(arr['c']),Array.isArray(arr['cc']))
 </script>

+ 5 - 3
resources/js/utilities/tempTip.js

@@ -67,13 +67,15 @@ const tempTip={
         tipper.remove();
         bg.remove();
     },
-    confirm:function(text,yesFunc,noFunc){
+    confirm:function(text,yesFunc,noFunc,yesText,noText){
+        if(typeof(yesText)==='undefined')yesText='确定';
+        if(typeof(noText)==='undefined')noText='取消';
         let bg=$("<div style='opacity:0.4;position:fixed;top:0;width:100%;height:100%;z-index:"+this.index+";background-color:#000;'></div>" );
         let tiper=$("<div class='row' style='color:#000;opacity:0.9;position:fixed;top:40%;transform:translateY(-50%);width:100%;z-index:"+(this.index+1)+"'>" +
             "<div class='col-8 offset-2'><div class='card'><div class='card-body'><div class='card-title h4'>" +
             text +
-            "</div><div class='card-text'><button class='btn btn-dark btn-lg ok'>确定</button>" +
-            "<button class='btn btn-success btn-lg cancel ml-4'>取消</button></div>" +
+            "</div><div class='card-text'><button class='btn btn-dark btn-lg ok'>"+yesText+"</button>" +
+            "<button class='btn btn-success btn-lg cancel ml-4'>"+noText+"</button></div>" +
             "</div></div></div></div>");
         let $ok = tiper.find('.ok');
         let $cancel = tiper.find('.cancel');

+ 6 - 3
resources/views/inventory/statement/dailyLog.blade.php

@@ -14,10 +14,10 @@
                     </div>
                     <div class="modal-body container row" style="text-align:center">
                         <div class="col-2 mt-2" v-for="owner in owners">
-                            <div style="border: 1px solid #aac7ea;height: 80px;text-align: center;line-height: 80px;border-radius: 4px;cursor: pointer"
+                            <div class="tooltipTarget" style="border: 1px solid #aac7ea;height: 80px;text-align: center;line-height: 80px;border-radius: 4px;cursor: pointer;overflow: hidden"
                                 :style="[{'background': loggingOwners.includes(Number(owner.name)) ? '#00FF00' : ''},
                                     {'box-shadow' : seekOwners.includes(owner.name) ? '0px 0px 10px 5px rgba(0,0,0,0.9)' : ''}]"
-                            @click="addLoggingOwner( owner.name,owner.value )">@{{ owner.value }}</div>
+                            @click="addLoggingOwner( owner.name,owner.value )" :title="owner.value">@{{ owner.value }}</div>
                         </div>
                     </div>
                 </div>
@@ -71,6 +71,7 @@
                     <td>@{{ inventoryDailyLog.commodity_height }}</td>
                     <td>@{{ inventoryDailyLog.commodity_volumn }}</td>
                     <td>@{{ inventoryDailyLog.volumn_occupied }}</td>
+                    <td>@{{ inventoryDailyLog.gross_weight }}</td>
                 </tr>
             </table>
             {{$inventoryDailyLogs->appends($param)->links()}}
@@ -100,7 +101,8 @@
                         commodity_width:'{{$inventoryDailyLog->commodity ? $inventoryDailyLog->commodity->width : ''}}',
                         commodity_height:'{{$inventoryDailyLog->commodity ? $inventoryDailyLog->commodity->height : ''}}',
                         commodity_volumn:'{{$inventoryDailyLog->commodity ? $inventoryDailyLog->commodity->volumn : ''}}',
-                        volumn_occupied:'{{$inventoryDailyLog->volumn_occupied}}'},
+                        volumn_occupied:'{{$inventoryDailyLog->volumn_occupied}}',
+                        gross_weight:'{{$inventoryDailyLog->gross_weight}}'},
                     @endforeach
                 ],
                 owners : [
@@ -163,6 +165,7 @@
                     {name: 'commodity_height', value: '高', neglect: true},
                     {name: 'commodity_volumn', value: '体积', neglect: true},
                     {name: 'volumn_occupied', value: '总占用体积', neglect: true},
+                    {name: 'gross_weight', value: '总毛重', neglect: true},
                 ];
                 let _this = this;
                 setTimeout(function () {

+ 525 - 0
resources/views/inventory/stockInventory/blindReceive.blade.php

@@ -0,0 +1,525 @@
+@extends('layouts.app')
+
+@section('content')
+    @component('inventory.stockInventory.menu')
+        <li class="nav-item">
+            <a  class="nav-link" href="{{URL::current()}}" :class="{active:isActive('blindReceive',3)}">盘点中({!! $inventoryAccount->id !!})</a>
+        </li>
+    @endcomponent
+    <div class="container">
+        <div class="mt-3">
+            <span>
+                <button class="btn btn-sm btn-outline-dark" @click="正常盘点(inventory.id)" >正常盘点</button>
+            </span>
+
+
+            <span class="form-group  mb-5">
+            <label class="text-muted">货主:</label><span class="font-weight-bold">@{{ inventory.owner.name }}</span>
+        </span>
+            <span class="form-group  p-2 mb-5">
+            <label >盘点单号:</label><span>@{{ inventory.id }}</span>
+        </span>
+            <span class="form-group p-2 mb-5">
+            <label class="text-muted">时间范围:</label><span>@{{ inventory.start_at }} 至 @{{ inventory.end_at }}</span>
+        </span>
+        </div>
+
+        <div class="mt-3">
+        <span class="h5">
+            <span class="form-group mb-5" v-if="inventory.status==='盘点中' || inventory.status==='待盘点'">
+                <label class=" font-weight-bold">已盘点:</label><span>@{{ inventory.processed }}/总数:@{{ inventory.total }}</span>
+            </span>
+            <span class="form-group mb-5" v-if="inventory.status==='盘点中' || inventory.status==='待盘点'">
+                <label class=" font-weight-bold">剩余数:</label><span>@{{ inventory.surplus }}</span>
+            </span>
+            <span class="form-group mb-5" v-if="inventory.status==='复盘中'&&未复盘有差异列">
+                <label class=" font-weight-bold">有差异未复盘数:</label><span>@{{ 未复盘有差异列.length }}</span>
+            </span>
+            <span class="form-group mb-5" v-if="inventory.status==='复盘中'&&未盘列">
+                <label class=" font-weight-bold">未盘点数:</label><span>@{{ 未盘列.length }}</span>
+            </span>
+            <span class="form-group mb-5" v-if="inventory.status==='复盘中'">
+                <label class=" font-weight-bold">总数:</label><span>@{{ inventory.total }}</span>
+            </span>
+            </span>
+        </div>
+
+
+        {{--    <div class="mt-3" >--}}
+        {{--        <span  class="btn  col-md-2 font-weight-bold"  style="cursor: default;max-width: 160px" :class="inventory.status=='盘点中' ||inventory.status=='待盘点'?'bg-info':'btn-outline-info disabled'">--}}
+        {{--            @{{ inventory.type }}--}}
+        {{--        </span>--}}
+        {{--        <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>--}}
+
+        <audio src="{{asset('sound/warning_otherBarcode.mp3')}}" controls="controls" preload id="soundWarning" hidden>
+        </audio>
+        <audio src="{{asset('sound/ding.mp3')}}" controls="controls" preload id="soundDing" hidden>
+        </audio>
+        <div class="row mt-2">
+            <div class="col-12" id="scanColumn">
+                <div class="card" :class="borderByMode">
+                    <div class="card-body">
+                        <div class="row">
+                            <div class="col-12">
+                                <p class="text-muted" style="font-size: 0.5em" v-if="inputMode=='regular'">常规:可输入效期,相同条码记录不会合并</p>
+                                <p class="text-muted" style="font-size: 0.5em" v-if="inputMode=='increasing'">逐一扫描:处理单一重复商品,每扫一次对应隔口总数量自动递增,扫到不同条码会提示</p>
+                                <p class="text-muted" style="font-size: 0.5em" v-if="inputMode=='multiIncreasing'">边扫边分:处理多种商品,自动将扫到的不同条码数量递增到各自隔口号</p>
+                                <ul class="nav nav-tabs mb-4 mt-n3">
+                                    <li class="nav-item"><a href="#" class="nav-link" :class="inputMode=='regular'?'active':''"
+                                                            @click="inputMode='regular';changeToManualInputAmount();cleanInputs();inputting.fromIncreasing=false">常规</a></li>
+                                    <li class="nav-item"><a href="#" class="nav-link" :class="inputMode=='increasing'?'active':''"
+                                                            @click="inputMode='increasing';changeToScanInputAmount();cleanInputs();inputting.fromIncreasing=true;">逐一扫描</a></li>
+                                    <li class="nav-item"><a href="#" class="nav-link" :class="inputMode=='multiIncreasing'?'active':''"
+                                                            @click="inputMode='multiIncreasing';changeToScanInputAmount();cleanInputs();inputting.fromIncreasing=true">边扫边分</a></li>
+                                </ul>
+                            </div>
+                            <div class="col-6">
+                                <div v-if="inputMode=='regular'">
+                                    <div class="btn btn-sm btn-outline-primary"
+                                         v-if="!isManualInputtingBarcode" @click="changeToManualInputBarcode">手动输入</div>
+                                    <div class="btn btn-sm btn-outline-danger"
+                                         @click="changeToScanInputBarcode" v-if="isManualInputtingBarcode">扫描输入</div>
+                                </div>
+                                <input type="text" id="barcode" class="form-control" :disabled="status.barcodeDisable" placeholder="扫入条码" @focusin="focusOutDocument" @focusout="focusDocument" v-model="inputting.barcode">
+                                <div >
+                                    <div >
+                                        库位:
+                                    </div>
+                                    <input type="text" class="form-control mb-2" v-model="location" @focusin="focusOutDocument"  @focusout="focusDocument" @keyup="oninputEnter">
+                                </div>
+                                <div v-if="inputMode=='regular'">
+                                    <div class="card-title">
+                                        生产日期:
+                                    </div>
+                                    <input type="date" class="form-control mb-2" v-model="inputting.produce_date" @focusin="focusOutDocument" @focusout="focusDocument" @keyup="oninputEnter">
+                                </div>
+                                <div v-if="inputMode=='regular'">
+                                    <div class="card-title">
+                                        失效日期:
+                                    </div>
+                                    <input type="date" class="form-control mb-2" v-model="inputting.valid_date" @focusin="focusOutDocument" @focusout="focusDocument" @keyup="oninputEnter">
+                                </div>
+                            </div>
+                            <div class="col-6">
+                                <div class="card-title" id="amountLabel">
+                                    手动输入数量:
+                                </div>
+                                <div class="input-group mt-n2 mb-2">
+                                    <input type="number" id="amount" class="form-control" placeholder="" :disabled="status.amountDisable"
+                                           v-model="inputting.amount" @focusin="focusOutDocument" @focusout="focusDocument" @keyup="oninputEnter"
+                                           style='height: 40px;font-size: 1.6em;color:blue;font-weight: bolder;padding: 3px;text-align: center'>
+                                </div>
+                                <div class="card-title">
+                                    格口号:
+                                </div>
+                                <input type="number" id="bin" class="form-control mt-n2 mb-2"
+                                       v-model="inputting.bin"
+                                       :disabled="status.binDisable" @focusin="focusOutDocument" @focusout="focusDocument" @keyup="oninputEnter"
+                                       style='height: 80px;font-size: 5em;color:red;font-weight: bolder;padding: 3px;text-align: center'>
+                                <div v-if="inputMode=='regular'">
+                                    <div class="card-title">
+                                        批次号:
+                                    </div>
+                                    <input type="text" class="form-control mb-2" v-model="inputting.batch_number" @focusin="focusOutDocument" @focusout="focusDocument" @keyup="oninputEnter">
+                                </div>
+                            </div>
+                            <div class="col-12" v-if="commitButtonVisible && inputMode=='regular'" >
+                                <button class="btn btn-success btn form-control" @click="commitGoods">确定</button>
+                            </div>
+                        </div>
+                        <p class="card-text text-muted mt-3 mb-n3 text-center">
+                            已完成:
+                        </p>
+                        <hr>
+                        <table class="table table-sm  table-striped" v-if="goodses.length>0">
+                            <tr>
+                                <th>隔口号</th>
+                                <th>数量</th>
+                                <th>条码</th>
+                                <th>生产日期</th>
+                                <th>失效日期</th>
+                                <th>批次号</th>
+                                <th>操作</th>
+                            </tr>
+                            <tr v-for="goods in goodses">
+                                <td>@{{ goods.bin }}</td>
+                                <td>@{{ goods.amount }}</td>
+                                <td>@{{ goods.barcode }}</td>
+                                <td>@{{ goods.produce_date }}</td>
+                                <td>@{{ goods.valid_date }}</td>
+                                <td>@{{ goods.batch_number }}</td>
+                                <td><button class="btn btn-outline-danger btn-sm" @click="removeGoods($event,goods.barcode)">删</button></td>
+                            </tr>
+                        </table>
+                        <hr>
+                        <span class="btn btn-outline-dark btn form-control" style="cursor: pointer" @click="submitStockInventory">结束并生成盘点</span>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+@endsection
+
+@section('lastScript')
+    <script>
+        new Vue({
+            el: '#app',
+            data:{
+                inventory:{!! $inventoryAccount!!},
+                focusing:'document',
+                commitButtonVisible:false,
+                isManualInputtingBarcode:false,
+                isManualInputtingAmount:true,
+                lastScannedBarcode:'',
+                inputMode:'regular',//regular,increasing,multiIncreasing
+                location:'',
+                inputting:{
+                    barcode:'',amount:'',bin:'',produce_date:'',valid_date:'',batch_number:'',fromIncreasing:false
+                },
+                status:{
+                    scanEndInputted:false,binDisable:false,barcodeDisable:true,amountDisable:false,
+                },
+                goodses:[],//{barcode,amount,bin,produce_date,valid_date,batch_number}
+            },
+            mounted() {
+                this.scanListening();
+            },
+            methods: {
+                正常盘点(id){
+                    window.location.href='{{url('inventory/stockInventory/enterStockInventory')}}/'+id;
+                },
+                changeToManualInputAmount:function(){
+                    this.status.amountDisable=false;
+                    this.isManualInputtingAmount=true;
+                    $('#amountLabel').text('输入数量:');
+                    // $('#amount').attr('placeholder','数字');
+                },
+                changeToScanInputAmount:function(){
+                    this.status.amountDisable=true;
+                    this.isManualInputtingAmount=false;
+                    $('#amountLabel').text('自动扫入数量:');
+                    // $('#amount').attr('placeholder','自动');
+                },
+                changeToManualInputBarcode:function(){
+                    this.status.barcodeDisable=false;
+                    this.isManualInputtingBarcode=true;
+                    $('#barcode').attr('placeholder','手工输入条码');
+                },
+                changeToScanInputBarcode:function(){
+                    let data = this;
+                    this.isManualInputtingBarcode=false;
+                    this.inputting.barcode='';
+
+                    let $barcode = $('#barcode');
+                    this.status.barcodeDisable=false;
+                    setTimeout(function () {
+                        $barcode.focus();
+                        data.status.barcodeDisable=true;
+                    },20);
+                    $barcode.attr('placeholder','扫入条码');
+                },
+                oninputEnter:function(e){
+                    if (e.key === 'Enter') {
+                        this.focusDocument();
+                    }
+                },
+                focusDocument: function () {
+                    this.focusing = 'document';
+                    this.showCommitButton();
+                },
+                focusOutDocument: function () {
+                    this.focusing = '';
+                    this.autoFillBin();
+                },
+                scanListening: function () {
+                    let data = this;
+                    $(document).on('keypress', function (e) {
+                        if(data.focusing!=='document'){return}
+                        if(data.isManualInputtingBarcode){return}
+                        if (e.keyCode !== 13) {
+                            if(data.status.scanEndInputted){
+                                data.lastScannedBarcode=data.inputting.barcode;
+                                data.inputting.barcode='';
+                                data.status.scanEndInputted=false;
+                            }
+                            data.inputting.barcode += String.fromCharCode(e.keyCode);
+                        } else {
+                            if(data.inputting.barcode.length<=1){
+                                window.tempTip.setDuration(4500);
+                                window.tempTip.show('未扫入条码,请检查扫码枪设置,尝试调至“直接键盘输出”模式');
+                                return;
+                            }
+                            data.status.scanEndInputted = true;
+                            data.showCommitButton();
+                            data.autoFillBin();
+                            switch(data.inputMode){
+                                case 'increasing': data.commitGoodsOnIncreasingMode();break;
+                                case 'multiIncreasing': data.commitGoodsOnMultiIncreasingMode();break;
+                            }
+                        }
+                    });
+                },
+                commitGoodsOnIncreasingMode: function () {
+                    let data = this;
+                    function doIt(){
+                        let repeatedBarcode=data.repeatedIncreasingBarcodeFromSaved();
+                        function increase(){
+                            data.inputting.bin=repeatedBarcode.bin;
+                            repeatedBarcode.amount++;
+                            data.inputting.amount=repeatedBarcode.amount;
+                            window.tempTip.setDuration(500);
+                            window.tempTip.showSuccess(repeatedBarcode.amount);
+                            data.focusDocument();
+                            data.audioDing();
+                        }
+                        if(!repeatedBarcode){
+                            data.focusOutDocument();
+                            data.alertVibrate();
+                            window.tempTip.setInputType('number');
+                            window.tempTip.inputVal('该商品第一件递增请输入隔口号:',function(bin){
+                                if(bin===''){
+                                    window.tempTip.setDuration(1500);
+                                    window.tempTip.show('未输入隔口号,请重新扫描');
+                                    data.alertVibrate();
+                                    data.focusDocument();return}
+                                data.inputting.bin=bin;
+                                data.inputting.amount=1;
+                                data.goodses.unshift(JSON.parse(JSON.stringify(data.inputting)));
+                                data.status.binDisable=true;
+                                window.tempTip.setDuration(500);
+                                window.tempTip.showSuccess('保存成功');
+                                data.focusDocument();
+                                data.audioDing();
+                            })
+                        }else{
+                            increase();
+                        }
+                    }
+                    if(data.lastScannedBarcode!==data.inputting.barcode && data.lastScannedBarcode){
+                        data.audioWarning_otherBarcode();
+                        data.focusOutDocument();
+                        window.tempTip.confirm('扫到其它条码,是否切换至新条码并记录?',doIt,function () {
+                            data.inputting.barcode=data.lastScannedBarcode;
+                            // data.cleanInputs();
+                            data.focusDocument();
+                        })
+                    }else{
+                        doIt()
+                    }
+                },
+                commitGoodsOnMultiIncreasingMode: function () {
+                    let data = this;
+                    let repeatedBarcode=this.repeatedIncreasingBarcodeFromSaved();
+                    function increase(){
+                        data.inputting.bin=repeatedBarcode.bin;
+                        repeatedBarcode.amount++;
+                        data.inputting.amount=repeatedBarcode.amount;
+                        window.tempTip.setDuration(500);
+                        window.tempTip.showSuccess(repeatedBarcode.amount);
+                        data.focusDocument();
+                        data.audioDing();
+                    }
+                    if(!repeatedBarcode){
+                        data.focusOutDocument();
+                        data.alertVibrate();
+                        window.tempTip.setInputType('number');
+                        window.tempTip.inputVal('该商品第一件递增请输入隔口号:',function(bin){
+                            if(bin===''){
+                                window.tempTip.setDuration(1500);
+                                window.tempTip.show('未输入隔口号,请重新扫描');
+                                data.alertVibrate();
+                                data.focusDocument();return}
+                            data.inputting.bin=bin;
+                            data.inputting.amount=1;
+                            data.goodses.unshift(JSON.parse(JSON.stringify(data.inputting)));
+                            data.status.binDisable=true;
+                            window.tempTip.setDuration(500);
+                            window.tempTip.showSuccess('保存成功');
+                            data.focusDocument();
+                            data.audioDing();
+                        })
+                    }else{
+                        increase();
+                    }
+                },
+                audioWarning_otherBarcode: function () {
+                    let audio = document.getElementById('soundWarning');
+                    audio.currentTime = 0;//重新播放
+                    if(audio.paused){
+                        audio.play();// 播放
+                    }
+                    this.alertVibrate();
+
+                },
+                audioDing: function () {
+                    let audio = document.getElementById('soundDing');
+                    audio.currentTime = 0;//重新播放
+                    audio.play();// 播放
+                    function startVibrate(duration) {
+                        if (navigator.vibrate) {
+                            navigator.vibrate(duration);
+                        } else if (navigator.webkitVibrate) {
+                            navigator.webkitVibrate(duration);
+                        }
+                    }
+                    startVibrate(500);
+                },
+                alertVibrate: function () {
+                    function startVibrate(duration) {
+                        if (navigator.vibrate) {
+                            navigator.vibrate(duration);
+                        } else if (navigator.webkitVibrate) {
+                            navigator.webkitVibrate(duration);
+                        }
+                    }
+                    let vibrateInterval = setInterval(function() {
+                        startVibrate(150);
+                    }, 50);
+                    setTimeout(function() {
+                        clearInterval(vibrateInterval)
+                    }, 2000);
+                },
+                autoFillBin: function () {
+                    let data = this;
+                    let isNotRepeatingBarcode=this.goodses.every(function(goods){
+                        if(goods.barcode===data.inputting.barcode){
+                            data.inputting.bin=goods.bin;
+                            data.status.binDisable=true;
+                            return false;
+                        }
+                        return true;
+                    });
+                    if(isNotRepeatingBarcode){
+                        data.status.binDisable=false;
+                    }
+                },
+                repeatedIncreasingBarcodeFromSaved: function () {
+                    let data = this;
+                    let repeatedGoods=null;
+                    data.goodses.every(function(goods){
+                        if(goods.barcode===data.inputting.barcode && goods.fromIncreasing){
+                            repeatedGoods=goods;
+                            return false;
+                        }
+                        return true;
+                    });
+                    return repeatedGoods;
+                },
+                commitGoods: function () {
+                    let data = this;
+                    window.tempTip.setDuration(3500);
+                    if(!data.inputting.barcode){window.tempTip.show('请扫入条码');return;}
+                    else if(!data.inputting.amount){window.tempTip.show('请输入数量');return;}
+                    else if(!data.inputting.bin){window.tempTip.show('请输入隔口号');return;}
+                    data.recordOrPlusGoods();
+                    window.tempTip.setDuration(1500);
+                    window.tempTip.showSuccess('成功提交:' + data.inputting.barcode);
+                    data.cleanInputs();
+                    data.audioDing();
+                },
+                cleanInputs: function () {
+                    this.changeToScanInputBarcode();
+                    this.inputting.barcode='';
+                    this.inputting.amount='';
+                    this.inputting.bin='';
+                    this.inputting.produce_date='';
+                    this.inputting.valid_date='';
+                    this.inputting.batch_number='';
+                    this.commitButtonVisible=false;
+                    this.status.binDisable=false;
+                    this.lastScannedBarcode='';
+                },
+                recordOrPlusGoods: function () {
+                    let data = this;
+                    if(this.inputMode==='regular'){
+                        data.goodses.unshift(JSON.parse(JSON.stringify(data.inputting)));
+                        return;
+                    }
+                    let isNotRepeating=data.goodses.every(function(goods){
+                        if(goods.barcode===data.inputting.barcode){
+                            goods.amount=parseInt(goods.amount)+parseInt(data.inputting.amount);
+                            return false;
+                        }
+                        return true;
+                    });
+                    if(isNotRepeating){
+                        data.goodses.unshift(JSON.parse(JSON.stringify(data.inputting)));
+                    }
+                },
+                removeGoods: function ($e,barcode) {
+                    if(!confirm('确定要删除条码为'+barcode+'的记录吗'))return;
+                    let data = this;
+                    data.goodses.every(function(goods,i){
+                        if(goods.barcode===barcode){
+                            data.goodses.splice(i,1)
+                            return false;
+                        }
+                        return true;
+                    })
+                },
+                showCommitButton: function () {
+                    let data = this;
+                    if(data.inputting.barcode && data.inputting.amount && data.inputting.bin){
+                        data.commitButtonVisible=true;
+                    }
+                },
+                submitStockInventory: function () {
+                    let data = this;
+                    data.focusOutDocument();
+                    if(data.goodses.length===0){
+                        window.tempTip.show('请先录入数据再提交盘点');return;
+                    }
+                    if(!data.location){
+                        window.tempTip.setDuration(1500);
+                        window.tempTip.show('库位为必填项');
+                        return;
+                    }
+                    window.tempTip.confirm('请检查表格,确定全部完成。提交后数据将全部清空,不能后退',
+                        function () {
+                                let url='{{url("inventory/stockInventory/baseOnBlindReceive")}}';
+                                axios.post(url,{'location':data.location,'goodses':data.goodses,'inventoryId':data.inventory.id,'owner_code':data.inventory.owner.code})
+                                    .then(function(response){
+                                        if(response.data.success){
+                                            data.goodses=[];
+                                            data.cleanInputs();
+                                            window.tempTip.cancelWaitingTip();
+                                            window.tempTip.setDuration(1500);
+                                            window.tempTip.showSuccess('盲收盘点成功,可返回盘点页面查看');
+                                            data.location='';
+                                            data.focusDocument();
+                                        }else{
+                                            window.tempTip.setDuration(1500);
+                                            window.tempTip.show('盲收盘点失败:'+response.data.fail_info);
+                                            console.log(response);
+                                            data.focusDocument();
+                                            data.alertVibrate()
+                                        }
+                                    })
+                                    .catch(function (err) {
+                                        window.tempTip.setDuration(3500);
+                                        window.tempTip.show('网络或系统错误,请将以下信息提交给开发者:'+err);
+                                        data.alertVibrate();
+                                    });
+                        },function () {
+                            data.focusDocument();
+                        })
+                }
+            },
+            computed: {
+                borderByMode: function () {
+                    return {
+                        // 'border-info':this.inputMode==='regular',
+                        'border-success':this.inputMode==='increasing',
+                        'border-danger':this.inputMode==='multiIncreasing'
+                    }
+                }
+            }
+        });
+    </script>
+@endsection

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

@@ -7,7 +7,10 @@
             <a  class="nav-link" href="{{URL::current()}}" :class="{active:isActive('enterStockInventory',3)}">盘点中({!! $inventoryAccount->id !!})</a>
         </li>
     @endcomponent
-    <div id="list" class="d-none container-fluid" >
+    <div class="text-center h5 mt-2" id="loadingPage">
+        载入中……
+    </div>
+    <div id="list" class="d-none container-fluid d-none" >
         <div class="mt-3">
             <span class="mt-3" >
                 @can('库存管理-盘点-完结')
@@ -32,6 +35,10 @@
                     <a class="dropdown-item" @click="inventoryAccountMissionExport(true)" href="javascript:">导出所有</a>
                 </div>
             </span>
+            <span>
+            <button class="btn btn-sm" @click="盲收(inventory.id)" :class="listMode?'btn-dark':'btn-outline-dark'" v-if="!listMode">盲收</button>
+{{--                <button class="btn btn-sm" @click="正常盘点()" :class="blindReceive?'btn-dark':'btn-outline-dark'" v-if="blindReceive">正常盘点</button>--}}
+            </span>
 
 
             <span class="form-group  mb-5">
@@ -71,7 +78,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,24 +105,23 @@
                 <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>
 
-                <span v-if="inventory.status=='复盘中'" class="form-group ml-4">
-            <label for="count" class="text-secondary">上一次盘点数:</label>
-            <span v-if="!指定盘点记录列.re_checked_amount">
-                <span  class="font-weight-bold" >@{{ 指定盘点记录列.verified_amount }}</span>
-            </span>
-            <span v-if="指定盘点记录列.re_checked_amount">
-                <span class="font-weight-bold">@{{ 指定盘点记录列.re_checked_amount }}</span>
-            </span>
-        </span>
+{{--                <span v-if="inventory.status=='复盘中'" class="form-group ml-4">--}}
+{{--            <label for="count" class="text-secondary">上一次盘点数:</label>--}}
+{{--            <span v-if="!指定盘点记录列.re_checked_amount">--}}
+{{--                <span  class="font-weight-bold" >@{{ 指定盘点记录列.verified_amount }}</span>--}}
+{{--            </span>--}}
+{{--            <span v-if="指定盘点记录列.re_checked_amount">--}}
+{{--                <span class="font-weight-bold">@{{ 指定盘点记录列.re_checked_amount }}</span>--}}
+{{--            </span>--}}
+{{--        </span>--}}
 
-                <span v-if="inventory.status=='复盘中'" class="form-group ml-4">
-            <label for="count" class="text-secondary">盘点差异数:</label>
-            <span v-if="指定盘点记录列.difference_amount" class="font-weight-bold">@{{ 指定盘点记录列.difference_amount }}</span>
-        </span>
+{{--                <span v-if="inventory.status=='复盘中'" class="form-group ml-4">--}}
+{{--            <label for="count" class="text-secondary">盘点差异数:</label>--}}
+{{--            <span v-if="指定盘点记录列.difference_amount" class="font-weight-bold">@{{ 指定盘点记录列.difference_amount }}</span>--}}
+{{--        </span>--}}
             </div>
             <!--相同库位和条码 pc端-->
             <div class="row d-none d-xl-block" v-if="指定盘点记录列.length>=1">
@@ -145,7 +153,7 @@
                                 <span class="btn btn-sm btn-outline-primary" @click="盘点选中任务(inventoryMission.id,inventoryMission.produced_at,inventoryMission.valid_at,inventoryMission.batch_number)">选定盘点</span>
                             </td>
                             <td>@{{ inventoryMission.location }}</td>
-                            <td v-if="inventoryMission.commodity">@{{ inventoryMission.commodity.name }}</td>
+                            <td v-if="inventoryMission.commodity">@{{ inventoryMission.commodity_name }}</td>
                             <td v-if="inventoryMission.commodity">
                                 <span v-if="inventoryMission.commodity_barcodes && inventoryMission.commodity_barcodes.length>0">
                             <span v-if="inventoryMission.commodity_barcodes.length==1">
@@ -407,7 +415,7 @@
                     </td>
                     @can('库存管理-盘点')
                         <td v-if="!listMode">
-                            {{--                        <span class="btn  btn-sm btn-outline-danger" @click="删除盘点记录(inventoryMission.id,inventory.id,inventoryMission.commodity.name)">删除</span>--}}
+{{--                            <span class="btn  btn-sm btn-outline-danger" @click="删除盘点记录(inventoryMission.id,inventory.id,inventoryMission.commodity.name)">删除</span>--}}
                             <span class="btn  btn-sm btn-outline-secondary" v-if="inventoryMission.checked==='否'"
                                   @click="跳过盘点记录(inventoryMission.id,inventory.id,inventoryMission.commodity.name)">跳过</span>
                             <span class="btn  btn-sm btn-outline-secondary"
@@ -605,16 +613,12 @@
                         stockInventoryPersons:{!! $inventoryMission->stockInventoryPersons  !!},
                         commodity_barcodes: [
                                 @foreach($inventoryMission->commodity ? $inventoryMission->commodity->barcodes ?? [] : [] as $barcode)
-                            {
-                                code: '{{$barcode->code}}'
-                            },
+                            {code: '{{$barcode->code}}'},
                             @endforeach
                         ],
                         stock_persons: [
                                 @foreach($inventoryMission->stockInventoryPersons ? $inventoryMission->stockInventoryPersons ?? [] : [] as $person)
-                            {
-                                name: '{{$person->mark}}'
-                            },
+                            {name: '{{$person->mark}}'},
                             @endforeach
                         ],
                         produced_at: '{{$inventoryMission->produced_at}}',
@@ -634,8 +638,8 @@
                     },
                     @endforeach
                 ],
-                条码索引_记录: [],
-                库位索引_记录: [],
+                条码索引_记录: {},
+                库位索引_记录: {},
                 checkData: [],
                 selectedStyle:'',
                 指定盘点记录列:[],
@@ -669,8 +673,11 @@
             },
             mounted: function () {
                 let _this = this;
+                (function 显示渲染后页面(){
+                    $('#loadingPage').remove();
+                    $('#list').removeClass('d-none');
+                })()
                 $(".tooltipTarget").tooltip({'trigger': 'hover'});
-                $("#list").removeClass('d-none');
                 $barcodeInput=$('#barcodeInput');
                 $locationInput=$('#locationInput');
                 $amountInput=$('#amountInput');
@@ -716,8 +723,7 @@
                     });
                     header.init();
                 },0);
-                this.以条码建立记录索引();
-                this.以库位建立记录索引();
+                this.建立记录索引();
             },
             methods:{
                 inputs() {
@@ -741,21 +747,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 +759,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){
@@ -796,20 +802,15 @@
                     }
                     this.筛选出记录(_this.inputs().location,_this.inputs().barcode);
                 },100,{ 'trailing': false }),
-                以条码建立记录索引(){
+                建立记录索引(){
                     let _this=this;
                     _this.inventoryMissions.forEach(function (inventoryMission) {
                         inventoryMission.commodity_barcodes.forEach(function (barcode) {
-                            _this.条码索引_记录[barcode.code]=inventoryMission;
-                            _this.条码索引_记录.push(_this.条码索引_记录[barcode.code])
+                            if(!Array.isArray(_this.条码索引_记录[barcode.code])) _this.条码索引_记录[barcode.code]=[];
+                            _this.条码索引_记录[barcode.code].push(inventoryMission);
                         })
-                    });
-                },
-                以库位建立记录索引(){
-                    let _this=this;
-                    _this.inventoryMissions.forEach(function (inventoryMission) {
-                        _this.库位索引_记录[inventoryMission.location]=inventoryMission;
-                        _this.库位索引_记录.push(_this.库位索引_记录[inventoryMission.location])
+                        if(!Array.isArray(_this.库位索引_记录[inventoryMission.location])) _this.库位索引_记录[inventoryMission.location]=[];
+                        _this.库位索引_记录[inventoryMission.location].push(inventoryMission);
                     });
                 },
                 清空指定盘点记录列(){
@@ -833,17 +834,20 @@
                     库位=库位.trim();
                     let _this=this;
                     if(!库位)return false;
-                    if(!条码)return false;
-                    if (!_this.库位索引_记录[库位]||(!_this.条码索引_记录[条码]&&(await _this.is条码存在于WMS(条码)))) return;
-                    _this.inventoryMissions.forEach(function (inventoryMission) {
-                        inventoryMission.commodity_barcodes.forEach(function (barcode) {
-                            if (inventoryMission.location===库位 && 条码===barcode.code){
+                    if(!条码)return false;;
+                    if (!_this.库位索引_记录[库位]
+                        ||(!_this.条码索引_记录[条码]
+                            &&!(await _this.is条码存在于WMS(条码)))
+                    ) return;
+                    if(Array.isArray(_this.条码索引_记录[条码])){
+                        _this.条码索引_记录[条码].forEach(function(inventoryMission){
+                            if (inventoryMission.location===库位){
                                 if(!_this.指定盘点记录列.includes(inventoryMission)){
                                     _this.指定盘点记录列.push(inventoryMission);
                                 }
                             }
-                        })
-                    });
+                        });
+                    }
                 },
                 放置焦点光标至正确位置:_.throttle(function(){
                     let _this=this;
@@ -877,7 +881,7 @@
                     if (!条码) return false;
                     if (_this.条码索引_记录[条码]) return true;
                     if (_this.条码索引_记录[条码] === false) return false;
-                    let url = '{{url('inventory / stockInventory / searchCommodityByBarcode')}}';
+                    let url = '{{url('inventory/stockInventory/searchCommodityByBarcode')}}';
                     let is成功 = false;
                     await axios.post(url, {
                         barcode: 条码,
@@ -899,16 +903,14 @@
                     条码 = 条码.trim();
                     let _this = this;
                     if (!条码) return false;
-                    if (!_this.条码索引_记录[条码]) return false;
-                    return !!_this.条码索引_记录[条码].id;
+                    return !!_this.条码索引_记录[条码];
 
                 },
                 is库位存在于当前记录(库位) {
                     库位 = 库位.trim();
                     let _this = this;
                     if (!库位) return false;
-                    if (!_this.库位索引_记录[库位]) return false;
-                    return !!_this.库位索引_记录[库位].id;
+                    return !!_this.库位索引_记录[库位];
 
                 },
                 提交新增并盘点:async function(){
@@ -927,7 +929,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 +944,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 +959,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 +1040,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.已复盘有差异列);
@@ -1149,7 +1153,7 @@
                     }).then(
                         function (response) {
                             if (!response.data.success) {
-                                tempTip.setDuration(3000);
+                                tempTip.setDuration(2000);
                                 tempTip.show('盘点单号:' + inventoryAccountMissionId + '删除失败!' + response.data.data);
                             } else {
                                 _this.inventoryMissions.every(function (inventoryAccountMission, i) {
@@ -1159,7 +1163,7 @@
                                     }
                                     return true
                                 });
-                                tempTip.setDuration(3000);
+                                tempTip.setDuration(2000);
                                 tempTip.showSuccess('盘点记录:' + inventoryAccountMissionId + '删除成功!');
                             }
                         }).catch(function (err) {
@@ -1170,9 +1174,8 @@
                 跳过盘点记录(inventoryAccountMissionId, inventoryAccountId, name) {
                     let _this = this;
                     if (!confirm('确定要跳过商品为:“' + name + '”的盘点记录吗?')) {
-                        return
+                        return ;
                     }
-                    ;
                     let url = '{{url('inventory/跳过盘点记录')}}';
                     axios.post(url, {
                         inventoryAccountMissionId: inventoryAccountMissionId,
@@ -1202,9 +1205,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) {
@@ -1227,30 +1229,25 @@
                 增加系统之外的盘点记录(location, barcode, count, inventoryId, owner_code, param) {
                     let _this = this;
                     let url = '{{url('inventory/增加系统之外的盘点记录')}}';
-                    axios.post(url, {
-                        location: location,
-                        barcode: barcode,
-                        count: count,
-                        inventoryId: inventoryId,
-                        owner_code: owner_code,
-                        param: param
-                    }).then(
+                    axios.post(url, {location:location,barcode:barcode,count:count,inventoryId:inventoryId,owner_code:owner_code,param:param}).then(
                         function (response) {
                             if (!response.data.success) {
                                 tempTip.setDuration(3000);
                                 tempTip.show('增加系统之外的盘点记录失败!');
                             } else {
-                                _this.inventoryMissions.push(response.data.inventoryAccountMission);
-                                _this.inventoryMissions.every(function (inventoryAccountMission, i) {
-                                    if (parseInt(inventoryAccountMission.id) === parseInt(response.data.inventoryAccountMission.id)) {
-                                        inventoryAccountMission = response.data.inventoryAccountMission;
-                                        inventoryAccountMission.stockInventoryPersons = response.data.stockInventoryPersons;
-                                        _this.inventoryMissions.splice(i, 1);
-                                        _this.inventoryMissions.unshift(inventoryAccountMission);
-                                        return false;
-                                    }
-                                    return true
+                                let inventoryAccountMission=response.data.inventoryAccountMission;
+                                inventoryAccountMission.commodity_barcodes = response.data.inventoryAccountMission.commodity.barcodes;
+                                inventoryAccountMission.commodity_name = response.data.inventoryAccountMission.commodity.name;
+                                inventoryAccountMission.stockInventoryPersons = response.data.stockInventoryPersons;
+                                inventoryAccountMission.produced_at = '';
+                                inventoryAccountMission.valid_at = '';
+                                _this.inventoryMissions.push(inventoryAccountMission);
+                                inventoryAccountMission.commodity_barcodes.forEach(function(barcode){
+                                    if(!Array.isArray(_this.条码索引_记录[barcode.code])) _this.条码索引_记录[barcode.code]=[];
+                                    _this.条码索引_记录[barcode.code].push(inventoryAccountMission);
                                 });
+                                if(!Array.isArray(_this.库位索引_记录[location])) _this.库位索引_记录[location]=[];
+                                _this.库位索引_记录[location].push(inventoryAccountMission);
                                 _this.重排序并标记全列表类型(_this.inventoryMissions);
                                 _this.清空inputs();
                                 tempTip.setDuration(3000);
@@ -1350,9 +1347,9 @@
                         },
                         function () {
                             _this.清空inputs();
-                            tempTip.setDuration(3000);
+                            tempTip.setDuration(1500);
                             tempTip.showSuccess('盘点成功!');
-                        })
+                        },'是','否')
                 },
                 清空inputs(){
                     $locationInput.val('');
@@ -1435,6 +1432,9 @@
                         tempTip.show('盘点失败!' + '网络错误' + err);
                     })
                 },
+                盲收(id){
+                    window.location.href='{{url('inventory/stockInventory/blindReceive')}}/'+id;
+                },
                 inventoryAccountMissionExport(checkAllSign) {
                     let url = '{{url('inventory/stockInventory/inventoryAccountMission/export')}}';
                     let token = '{{ csrf_token() }}';

+ 24 - 9
resources/views/inventory/stockInventory/mission.blade.php

@@ -4,7 +4,10 @@
 
 @section('content')
     @component('inventory.stockInventory.menu')@endcomponent
-    <div id="list" class="container-fluid" style="min-width: 1500px">
+    <div class="text-center h5 mt-2" id="loadingPage">
+        载入中……
+    </div>
+    <div id="list" class="container-fluid d-none" style="min-width: 1500px">
         <form class="form-inline mt-2">
             <span class="form-inline ml-5">
                  <span class="btn btn-sm btn-outline-secondary tooltipTarget" @click="syncOwners">同步货主</span>
@@ -17,12 +20,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 +59,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 +110,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,13 +118,15 @@
                 selectedStyle:'',
                 sum:{!! $inventoryAccounts->total() !!},
                 // formData:{},
-                date_end:'',
-                date_start:'',
+                date_end:'',location:'',barcode:'', date_start:'',
                 fakeOwners:'',
             },
             mounted: function () {
                 $(".tooltipTarget").tooltip({'trigger': 'hover'});
-                $("#list").removeClass('d-none');
+                (function 显示渲染后页面(){
+                    $('#loadingPage').remove();
+                    $('#list').removeClass('d-none');
+                })()
                 this.fakeOwners=this.owners;
                 let _this = this;
                 let column = [
@@ -315,6 +324,12 @@
                 hasDateEnd(){
                     this.date_end=document.getElementById('date_end').value;
                 },
+                hasLocation(){
+                    this.location=$('#location').val().trim();
+                },
+                hasBarcode(){
+                    this.barcode=$('#barcode').val();
+                },
             }
         });
     </script>

+ 1 - 1
resources/views/layouts/app.blade.php

@@ -32,7 +32,7 @@
 <!-- Scripts -->
 @yield('script')
 {{-- 必须在app.js前边--}}
-<script src="{{ asset('js/app200922.js') }}"></script>
+<script src="{{ asset('js/app200924.js') }}"></script>
 <script>
     let isActive=function (name,atSlashLevel) {
         let uriWithNoParam=location.href.split('?')[0];

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

@@ -454,7 +454,7 @@
                     if (!type)_this.sum+= Number(amount);
                     _this.processContents.some(function (processContent) {
                         if (processContent.wms_code==wms_code && processContent.commodity_id==commodity_id && processContent.type==type) {
-                            processContent.commodities.every(function (commodity) {
+                            /*processContent.commodities.every(function (commodity) {
                                 if (commodity.id===commodity_id && commodity.amount<amount){
                                     tempTip.setDuration(2000);
                                     tempTip.show("数量不得超出原有数量!");
@@ -463,7 +463,7 @@
                                 }
                                 return true;
                             });
-                            if (is_return)return true;
+                            if (is_return)return true;*/
                             _this._addSignCommodity(wms_code,processContent.commodity_id,type);
                             processContent.addBtnShow=false;
                             processContentTemp=Object.assign({},processContent);

+ 2 - 2
resources/views/store/checkingReceive/mission.blade.php

@@ -70,7 +70,7 @@
                 <button v-if="storeCheckingReceive.status != '已收货'" class="btn btn-sm btn-outline-success" data-toggle="modal" data-target="#asnWindow" @click="thisIndex=i">
                     <span v-if="storeCheckingReceive.asn">重新</span>匹配ASN号
                 </button>@endcan
-                @can('入库管理-快速入库-录入')
+                @can('入库管理-快速入库')
                 <button v-if="storeCheckingReceive.status=='已ASN入库' && storeCheckingReceive.is_receive_diff != '是' && storeCheckingReceive.is_asn_diff != '是' && storeCheckingReceive.status != '已收货'"
                         class="btn btn-sm btn-outline-info" @click="receipt(i)">快速入库</button>
                 @endcan
@@ -279,4 +279,4 @@
             },
         });
     </script>
-@stop
+@stop

+ 8 - 0
resources/views/store/index.blade.php

@@ -0,0 +1,8 @@
+@extends('layouts.app')
+@section('title')入库管理@endsection
+
+@section('content')
+    <span id="nav2">
+        @component('store.menu')@endcomponent
+    </span>
+@endsection

+ 2 - 1
routes/web.php

@@ -365,12 +365,13 @@ Route::group(['prefix'=>'inventory'],function(){
     /** 库存盘点 */
     Route::group(['prefix'=>'stockInventory'],function(){
         Route::get('mission','InventoryAccountController@mission');
-        //Route::post('createStockInventoryMission','InventoryAccountController@createStockInventoryMission');
         Route::any('enterStockInventory/{id}','InventoryAccountController@enterStockInventory');
         Route::any('inventoryAccountMission/export','InventoryAccountController@exportInventoryAccountMission');
         Route::get('mission','InventoryAccountController@mission');
         Route::post('createStockInventoryMission','InventoryAccountController@createStockInventoryMission');
         Route::post('searchCommodityByBarcode','InventoryAccountController@searchCommodityByBarcode');
+        Route::get('blindReceive/{id}','InventoryAccountController@enterBlindReceive');
+        Route::post('baseOnBlindReceive','InventoryAccountController@baseOnBlindReceive');
     });
     /** 库存比对 */
     Route::group(['prefix'=>'inventoryCompare'],function(){

+ 1 - 1
webpack.mix.js

@@ -11,7 +11,7 @@ const mix = require('laravel-mix');
  |
  */
 
-mix.js('resources/js/app.js', 'public/js/app200922.js')
+mix.js('resources/js/app.js', 'public/js/app200924.js')
     .sass('resources/sass/app.scss', 'public/css/app200923.css');
 mix.copy('resources/sass/fonts/','public/fonts');
 mix.copy('resources/icon','public/icon');