Browse Source

Merge branch 'master' into zengjun

ajun 5 years ago
parent
commit
2ebdca3f2c
57 changed files with 1559 additions and 866 deletions
  1. 1 3
      app/Commodity.php
  2. 135 0
      app/Console/Commands/InventoryDailyLoggingOwner.php
  3. 1 0
      app/Console/Kernel.php
  4. 137 0
      app/Http/Controllers/InventoryAccountController.php
  5. 79 117
      app/Http/Controllers/InventoryController.php
  6. 9 9
      app/Http/Controllers/InventoryMissionController.php
  7. 37 3
      app/Http/Controllers/OrderController.php
  8. 4 0
      app/Http/Controllers/TestController.php
  9. 7 6
      app/InventoryAccount.php
  10. 2 2
      app/InventoryAccountMission.php
  11. 20 0
      app/InventoryDailyLog.php
  12. 16 0
      app/InventoryDailyLoggingOwner.php
  13. 18 0
      app/Services/CommodityService.php
  14. 238 0
      app/Services/InventoryAccountService.php
  15. 23 186
      app/Services/InventoryService.php
  16. 1 1
      app/Services/LaborReportService.php
  17. 1 1
      app/Services/PackageService.php
  18. 1 1
      app/Services/ProcessService.php
  19. 1 1
      app/Services/RejectedService.php
  20. 1 1
      app/Services/WaybillService.php
  21. 14 79
      app/Services/common/QueryService.php
  22. 2 2
      database/factories/InventoryFactory.php
  23. 3 3
      database/factories/InventoryMissionFactory.php
  24. 46 0
      database/migrations/2020_08_25_180030_create_inventory_daily_logs_table.php
  25. 33 0
      database/migrations/2020_08_25_180623_create_inventory_daily_logging_owners_table.php
  26. 38 0
      database/migrations/2020_08_25_180803_change_commodities_add_column_length_width_height_volumn.php
  27. 49 0
      database/migrations/2020_08_26_093946_change_inventory_missions_to_inventory_account_missions.php
  28. 41 0
      database/migrations/2020_08_26_094015_change_inventories_to_inventory_accounts.php
  29. 3 3
      public/js/app.js
  30. 1 1
      resources/js/utilities/tempTip.js
  31. 0 199
      resources/views/inventory/statement/allInventory.blade.php
  32. 4 0
      resources/views/inventory/statement/changeInventory.blade.php
  33. 248 0
      resources/views/inventory/statement/dailyLog.blade.php
  34. 4 0
      resources/views/inventory/statement/menu.blade.php
  35. 62 37
      resources/views/inventory/stockInventory/inventoryMission.blade.php
  36. 101 54
      resources/views/inventory/stockInventory/mission.blade.php
  37. 20 4
      resources/views/order/index/delivering.blade.php
  38. 2 2
      resources/views/order/issue/import.blade.php
  39. 1 1
      resources/views/order/issue/index.blade.php
  40. 2 2
      resources/views/rejected/search/analyze.blade.php
  41. 10 6
      routes/web.php
  42. 27 0
      tests/Inventory/Services/InventoryAccountService/InventoryAccountService_ConditionSearchTest.php
  43. 14 12
      tests/Inventory/Services/InventoryAccountService/InventoryAccountService_CreateInventoryMissionRecordTest.php
  44. 9 9
      tests/Inventory/Services/InventoryAccountService/InventoryAccountService_CreateMissionTest.php
  45. 6 6
      tests/Inventory/Services/InventoryAccountService/InventoryAccountService_GetTest.php
  46. 8 8
      tests/Inventory/Services/InventoryAccountService/InventoryAccountService_PaginateTest.php
  47. 11 11
      tests/Inventory/Services/InventoryAccountService/InventoryAccountService_SearchStockInventoryRecordTest.php
  48. 10 10
      tests/Inventory/Services/InventoryAccountService/InventoryAccountService_SomeTest.php
  49. 10 10
      tests/Inventory/Services/InventoryAccountService/InventoryAccountService_StockInventoryTest.php
  50. 0 27
      tests/Inventory/Services/InventoryService/InventoryService_ConditionSearchTest.php
  51. 8 9
      tests/Inventory/http/InventoryAccountControllor/InventoryAccountController_CreateStockInventoryMissionTest.php
  52. 3 3
      tests/Inventory/http/InventoryAccountControllor/InventoryAccountController_DeleteStockInventoryMissionTest.php
  53. 10 10
      tests/Inventory/http/InventoryAccountControllor/InventoryAccountController_EnterStockInventoryTest.php
  54. 1 1
      tests/Inventory/http/InventoryAccountControllor/InventoryAccountController_MissionTest.php
  55. 7 7
      tests/Inventory/http/InventoryAccountControllor/InventoryAccountController_SearchStockInventoryRecordTest.php
  56. 7 7
      tests/Inventory/http/InventoryAccountControllor/InventoryAccountController_StockInventoryTest.php
  57. 12 12
      tests/Inventory/model/InventoryAccountTest.php

+ 1 - 3
app/Commodity.php

@@ -9,7 +9,7 @@ use App\Traits\ModelTimeFormat;
 class Commodity extends Model
 {
     use ModelTimeFormat;
-    protected $fillable=['name','sku','owner_id','created_at'];
+    protected $fillable=['name','sku','owner_id','created_at','length','width','height','volumn'];
     protected $appends=['barcode','owner_name','owner_code'];
 
     public function barcodes()
@@ -20,7 +20,6 @@ class Commodity extends Model
         return $this->belongsTo('App\Owner','owner_id','id');
     }
     public function getBarcodeAttribute(){
-//        return $this->barcodes()->first()['code'];
         return $this->barcodes[0]['code']??'';
     }
     public function getOwnerNameAttribute(){
@@ -64,7 +63,6 @@ class Commodity extends Model
         }
         foreach ($barcodes as $barcode){
             if(!trim($barcode))continue;
-//            if(preg_match('/[\x{4e00}-\x{9fa5}]/u',$barcode))continue;
             $commodityBarcode=CommodityBarcode::where('code',$barcode)->where('commodity_id',$commodity['id'])->first();
             if(!$commodityBarcode){
                 $commodityBarcode=new CommodityBarcode(['code'=>$barcode,'commodity_id'=>$commodity['id']]);

+ 135 - 0
app/Console/Commands/InventoryDailyLoggingOwner.php

@@ -0,0 +1,135 @@
+<?php
+
+namespace App\Console\Commands;
+
+use App\CommodityBarcode;
+use App\Services\CommodityService;
+use Illuminate\Console\Command;
+use App\InventoryDailyLoggingOwner as LoggingOwner;
+use Illuminate\Support\Facades\DB;
+
+class InventoryDailyLoggingOwner extends Command
+{
+    /**
+     * The name and signature of the console command.
+     *
+     * @var string
+     */
+    protected $signature = 'InventoryDailyLoggingOwner';
+
+    /**
+     * The console command description.
+     *
+     * @var string
+     */
+    protected $description = '监听指定货主记录';
+
+    /**
+     * Create a new command instance.
+     *
+     * @return void
+     */
+    public function __construct()
+    {
+        parent::__construct();
+    }
+
+    /**
+     * Execute the console command.
+     * @param CommodityService $commodityService
+     * @return int
+     */
+    public function handle(CommodityService $commodityService)
+    {
+        //获取需要查询的货主,键值对:code => id
+        $owners = $this->getLoggingOwners();
+        //计算数量,为0直接return
+        $let = count($owners);
+        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 
+                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 (";
+        $index = 1;
+        foreach ($owners as $code => $id){
+            $sql .= "'".$code."'";
+            if ($index != $let)$sql .= ",";
+            $index++;
+        }
+        $sql .= ")";
+        //执行获取结果:stdClass类型
+        $invLots = DB::connection('oracle')->select(DB::raw($sql));
+        //声明一个数组,作为第一次去重的容器
+        $inventoryDailyLogs = [];
+        foreach ($invLots as $invLot){
+            //以MAP形式记录进数组,货主code与商品sku作为联合主键唯一标识,如重复叠加其数量
+            if ($inventoryDailyLogs[$owners[$invLot->customerid].'-'.$invLot->sku] ?? false){
+                $inventoryDailyLogs[$owners[$invLot->customerid].'-'.$invLot->sku]['amount'] += $invLot->qty;
+            }else{
+                //符合的结果取此对象的关键信息存进第一个数组
+                $inventoryDailyLogs[$owners[$invLot->customerid].'-'.$invLot->sku] = [
+                    'commodity' => [
+                        'owner_id'=>$owners[$invLot->customerid],
+                        'sku'=>$invLot->sku,
+                        'name'=>$invLot->descr_c,
+                        'length'=>$invLot->skulength,
+                        'width'=>$invLot->skuwidth,
+                        'height'=>$invLot->skuhigh,
+                        'volumn'=>$invLot->cube,
+                        'code'=>$invLot->alternate_sku1,
+                    ],
+                    'amount' => $invLot->qty,
+                    'volumn_occupied' => 0,
+                ];
+            }
+        }
+        //第二个数组作为批量插入使用
+        $data = [];
+        //遍历第一个数组,此时已经去重完成,直接取对应参数push进data中
+        foreach ($inventoryDailyLogs as $inventoryDailyLog){
+            //寻找己方库中是否存在对应商品,存在更新其长宽高体积,不存在录入
+            $commodity = $inventoryDailyLog['commodity'];
+            $param = ['owner_id'=>$commodity['owner_id'],'sku'=>$commodity["sku"]];
+            //体积存在为0的情况,需再次计算一次,此处体积为m³
+            if (!$commodity['volumn'] || $commodity['volumn'] == "0"){
+                $commodity['volumn'] = $commodity['length']*$commodity['width']*$commodity['height'];
+            }
+            $column = [
+                'owner_id'=>$commodity['owner_id'],
+                'sku'=>$commodity['sku'],
+                'name'=>$commodity['name'],
+                'length'=>$commodity['length'],
+                'width'=>$commodity['width'],
+                'height'=>$commodity['height'],
+                'volumn'=>$commodity['volumn'],
+            ];
+            $result = $commodityService->updateOrCreate($param,$column);
+            $commodity_id = $result->id;
+            //寻找对应barcode是否存在,不存在录入
+            if ($commodity['code']) CommodityBarcode::query()->firstOrCreate(['commodity_id'=>$commodity_id,'code'=>$commodity['code']]);
+            //计算总体积,商品体积×该单数量
+            $volumn_occupied = $commodity['volumn']*$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,
+            ]);
+        }
+        DB::table('inventory_daily_logs')->insert($data);
+    }
+
+    public function getLoggingOwners(){
+        $loggingOwners = LoggingOwner::with('owner')->select('id','owner_id')->where('status','启用')->get();
+        $owners = [];
+        foreach ($loggingOwners as $loggingOwner){
+            if ($loggingOwner->owner){
+                $owners[$loggingOwner->owner->code] = $loggingOwner->owner_id;
+            }
+        }
+        return $owners;
+    }
+}

+ 1 - 0
app/Console/Kernel.php

@@ -29,6 +29,7 @@ class Kernel extends ConsoleKernel
     protected function schedule(Schedule $schedule)
     {
         $schedule->command('LogExpireDelete')->dailyAt('00:01');
+        $schedule->command('InventoryDailyLoggingOwner')->dailyAt('08:00');
         $schedule->command('FluxOrderFix')->hourlyAt(1);
     }
 

+ 137 - 0
app/Http/Controllers/InventoryAccountController.php

@@ -0,0 +1,137 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use App\Exports\Export;
+use App\InventoryAccount;
+use App\InventoryAccountMission;
+use App\Owner;
+use App\Services\InventoryAccountService;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Gate;
+use Maatwebsite\Excel\Facades\Excel;
+
+class InventoryAccountController extends Controller
+{
+    public function __construct()
+    {
+        app()->singleton('inventoryAccountService',InventoryAccountService::class);
+    }
+
+    //创建盘点任务
+    public function createStockInventoryMission(Request $request){
+        if(!Gate::allows("库存管理-盘点")){ return redirect(url('/'));  }
+//        $date_start=$request->input('formData.date_start');
+//        $date_end=$request->input('formData.date_end');
+//        $ownerId=$request->input('formData.owner_id')[0];
+        $date_start=$request->input('date_start');
+        $date_end=$request->input('date_end');
+        $ownerId=$request->input('owner_id');
+        $inventoryAccount=app('inventoryAccountService')->createMission($date_start,$date_end,$ownerId);
+        $inventoryAccount=InventoryAccount::with('owner')->find($inventoryAccount->id);
+        if (is_null($inventoryAccount)) return ['success'=>false,'data'=>'参数错误!'];
+        return ['success'=>true,'data'=>$inventoryAccount];
+    }
+    //删除盘点任务
+    public function deleteStockInventoryMission($id){
+        if(!Gate::allows('库存管理-盘点')){return['success'=>0,'status'=>'没有权限'];}
+        if(is_null($id)){return ['success'=>false,'data'=>'传入id为空'];}
+        $inventoryAccount=InventoryAccount::where('id',$id)->delete();
+        return ['success'=>true,'data'=>$inventoryAccount];
+    }
+
+
+
+    //盘点-任务页面
+    public function mission(Request $request){
+        if(!Gate::allows("库存管理-盘点")){ return redirect(url('/'));  }
+        $paginateParams = $request->input();
+        $queryParam=$request->all();
+        $inventoryAccounts=app('inventoryAccountService')->paginate($queryParam);
+        $owners=Owner::select('id','name')->get();
+        return view('inventory.stockInventory.mission',compact('owners','inventoryAccounts','paginateParams'));
+    }
+    //进入盘点中或复盘页面
+    public function enterStockInventory($id){
+        if (!Gate::allows('库存管理-盘点')){return redirect(url('/')); }
+        if (!$id) return ['success'=>false,'data'=>'参数错误!'];
+        $inventoryAccount=InventoryAccount::with('owner')->find($id);
+        $inventoryAccountMissions=InventoryAccountMission::with(['commodity'=>function($query){
+           return $query->with(['barcodes']);
+        }])->where('inventory_account_id',$id)->orderBy('difference_amount','desc')->get();
+        return view('inventory.stockInventory.inventoryMission',compact('inventoryAccount','inventoryAccountMissions'));
+    }
+
+
+
+    //依据盘点任务id进行 --盘点
+    public function stockInventory(Request $request){
+        if (!Gate::allows('库存管理-盘点')){return redirect(url('/')); }
+        $location=$request->input('location');
+        $barcode=$request->input('barcode');
+        $inventoryId=$request->input('inventoryId');
+        $count=$request->input('count');
+        if (is_null($count)) return ['success'=>false,'data'=>'盘点数不能为空!'];
+        $inventoryAccountMission=app('inventoryAccountService')->stockInventory($location,$barcode,$count,$inventoryId);
+        if (!$inventoryAccountMission)return ['success'=>false,'data'=>'参数错误!'];
+        $inventoryAccount=app('inventoryAccountService')->updateInventory($inventoryId);
+        return ['success'=>true,'inventoryMission'=>$inventoryAccountMission,'inventory'=>$inventoryAccount];
+    }
+    //根据该库存和产品条码查询该条盘点记录
+    public function searchStockInventoryRecord(Request $request){
+        if (!Gate::allows('库存管理-盘点')){return redirect(url('/')); }
+        $location=$request->input('location');
+        $barcode=$request->input('barcode');
+        $inventoryId=$request->input('inventoryId');
+        $inventoryAccountMission=app('inventoryAccountService')->searchStockInventoryRecord($location,$barcode,$inventoryId);
+        if (!$inventoryAccountMission)return ['success'=>false,'data'=>'参数错误!'];
+        return ['success'=>true,'data'=>$inventoryAccountMission];
+    }
+
+    //盘点任务导出
+    public function stockInventoryExport(Request $request){
+        if (!Gate::allows('库存管理-盘点')){return redirect(url('/')); }
+        ini_set('max_execution_time',3500);
+        ini_set('memory_limit','3526M');
+        if ($request->checkAllSign){
+            $request->offsetUnset('checkAllSign');
+            $queryParam=$request->all();
+            $inventoryAccounts=app('inventoryAccountService')->get($queryParam);
+        }else{
+            $queryParam=$request->all();
+            $inventoryAccounts=app('inventoryAccountService')->some($queryParam);
+        }
+        $row=[[
+            'id'=>'盘点编号',
+            'created_at'=>'创建时间',
+            'owner_id'=>'货主',
+            'type'=>'任务类型',
+            'start_at'=>'起始时间',
+            'end_at'=>'结束时间',
+            'total'=>'记录数',
+            'processed'=>'已盘数',
+            'surplus'=>'剩余数',
+            'difference'=>'复盘差异',
+            'returned'=>'复盘归位',
+        ]];
+        $list=[];
+        for ($i=0; $i<count($inventoryAccounts);$i++){
+            $inventoryAccount=$inventoryAccounts[$i];
+            $w=[
+                'id'=>isset($inventoryAccount->id)?$inventoryAccount->id:'',
+                'created_at'=>isset($inventoryAccount->created_at)?$inventoryAccount->created_at:'',
+                'owner_id'=>isset($inventoryAccount->owner->name)?$inventoryAccount->owner->name:'',
+                'type'=>isset($inventoryAccount->type)?$inventoryAccount->type:'',
+                'start_at'=>isset($inventoryAccount->start_at)?$inventoryAccount->start_at:'',
+                'end_at'=>isset($inventoryAccount->end_at)?$inventoryAccount->end_at:'',
+                'total'=>isset($inventoryAccount->total)?$inventoryAccount->total:'',
+                'processed'=>isset($inventoryAccount->processed)?$inventoryAccount->processed:'',
+                'surplus'=>isset($inventoryAccount->surplus)?$inventoryAccount->surplus:'',
+                'difference'=>isset($inventoryAccount->difference)?$inventoryAccount->difference:'',
+                'returned'=>isset($inventoryAccount->returned)?$inventoryAccount->returned:'',
+            ];
+            $list[$i]=$w;
+        }
+        return Excel::download(new Export($row,$list),date('YmdHis', time()).'-盘点任务记录单.xlsx');
+    }
+}

+ 79 - 117
app/Http/Controllers/InventoryController.php

@@ -4,10 +4,13 @@ namespace App\Http\Controllers;
 
 use App\Exports\Export;
 use App\Inventory;
+use App\InventoryDailyLoggingOwner;
 use App\InventoryMission;
 use App\OracleBasCustomer;
 use App\Owner;
 use App\Services\InventoryService;
+use App\Services\OwnerService;
+use App\Services\InventoryAccountService;
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\Gate;
@@ -90,7 +93,53 @@ class InventoryController extends Controller
         if ($page&&$paginate)$sql.="  and ROWNUM<='".$page*$paginate."'";
         $sql.=' )  ';
         if ($page&&$paginate)$sql.="  where rn>'".($page-1)*$paginate."'";
-        //dd($sql);
+        return DB::connection('oracle')->select($sql);
+    }
+    private function conditionQueryAllInventory(Request $request,$page=null,$paginate=null){
+        $date_start=$request->date_start;
+        $range = $request->range;
+        if ($range)$date_start=date('Y-m-d',strtotime('-'.$range." day"));
+        $date_end=$request->date_end;
+        $TOLocation=$request->TOLocation;
+        $LotAtt05=$request->LotAtt05;
+        $LotAtt02_start=$request->LotAtt02_start;
+        $descr_c=$request->descr_c;
+        $SKU=$request->SKU;
+        $ALTERNATE_SKU1=$request->ALTERNATE_SKU1;
+        $LotAtt02_end=$request->LotAtt02_end;
+        $sql='select * from (select result.*,rownum rn from (';
+        $sql.=' select customer.Descr_C as 货主,storeStatus.CUSTOMERID 客户,storeStatus.LocationID 库位, sku.SKU 产品编码, sku.ALTERNATE_SKU1 产品条码, ';
+        $sql.=' sku.Descr_C 商品名称, lot.LotAtt05 属性仓, lot.LotAtt08 质量状态, lot.LotAtt02 失效日期, storeStatus.ADDTIME 创建时间, ';
+        $sql.=' lot.LotAtt04 批号 ';
+        $sql.=' , storeStatus.QTY 在库数量, storeStatus.QtyAllocated 占用数量,count(1) over () as sum from ';
+        $sql.=' INV_LOT_LOC_ID storeStatus';
+        $sql.=' left join BAS_Customer customer on customer.CustomerID=storeStatus.CUSTOMERID ';
+        $sql.=' left join BAS_SKU sku on sku.SKU=storeStatus.SKU and sku.CUSTOMERID=storeStatus.CUSTOMERID ';
+        $sql.=' left join INV_LOT_ATT lot on lot.LOTNUM = storeStatus.LOTNUM AND lot.CUSTOMERID = storeStatus.CUSTOMERID ';
+        $sql.=' group by storeStatus.LocationID,customer.Descr_C,sku.SKU,sku.ALTERNATE_SKU1 ';
+        $sql.=' ,sku.Descr_C,lot.LotAtt05,lot.LotAtt08,lot.LotAtt02,lot.LotAtt04 ';
+        $sql.=' , storeStatus.QTY, storeStatus.QtyAllocated,storeStatus.CUSTOMERID,storeStatus.ADDTIME  ';
+        $sql.=' )result where 1=1 ';
+        if ($TOLocation)$sql .= " and 库位 like '".$TOLocation."' ";
+        if ($SKU)$sql.=" and 产品编码 like '".$SKU."' ";
+        if ($LotAtt05)$sql .=" and 属性仓 like '".$LotAtt05."' ";
+        if ($date_start)$sql.=" and 创建时间 > to_date('".$date_start." 00:00:00','yyyy-mm-dd hh24:mi:ss') ";
+        if ($date_end)$sql.=" and 创建时间 < to_date('".$date_end." 23:59:59','yyyy-mm-dd hh24:mi:ss') ";
+        if ($LotAtt02_start)$sql.=" and 失效日期 >='".$LotAtt02_start." 00:00:00' ";
+        if ($LotAtt02_end)$sql.=" and 失效日期 <='".$LotAtt02_end." 23:59:59' ";
+        if ($descr_c){
+            $sql .= ' and 货主 in (';
+            $descr_cs = explode(',',$descr_c);
+            foreach ($descr_cs as $index => $descr_c){
+                if ($index != 0)$sql .= ',';
+                $sql .= "'".$descr_c."'";
+            }
+            $sql .= ') ';
+        }
+        if ($ALTERNATE_SKU1)$sql.=" and 产品条码 like '".$ALTERNATE_SKU1."' ";
+        if ($page&&$paginate)$sql.="  and ROWNUM<='".$page*$paginate."'";
+        $sql.=' )  ';
+        if ($page&&$paginate)$sql.="  where rn>'".($page-1)*$paginate."'";
         return DB::connection('oracle')->select($sql);
     }
     //动库报表
@@ -101,17 +150,19 @@ class InventoryController extends Controller
         $oracleActTransactingLogs=$this->conditionQuery($request,$page,$paginate);
         $oracleActTransactingLogs=json_encode($oracleActTransactingLogs);
         $owners=OracleBasCustomer::select('descr_c')->where('customer_type','OW')->where('active_flag','Y')->get();
-        return view('inventory.statement.changeInventory',compact('oracleActTransactingLogs','page','owners'));
+        $isTotalStock=false;
+        return view('inventory.statement.changeInventory',compact('oracleActTransactingLogs','page','owners','isTotalStock'));
     }
     //全部库存
     public function allInventory(Request $request){
         if(!Gate::allows("库存管理-库存")){ return redirect(url('/'));  }
         $page=$request->page??1;
         $paginate=$request->input('paginate')??50;
-        $oracleActTransactingLogs=$this->conditionQuery($request,$page,$paginate);
+        $oracleActTransactingLogs=$this->conditionQueryAllInventory($request,$page,$paginate);
         $oracleActTransactingLogs=json_encode($oracleActTransactingLogs);
         $owners=OracleBasCustomer::select('descr_c')->where('customer_type','OW')->where('active_flag','Y')->get();
-        return view('inventory.statement.allInventory',compact('oracleActTransactingLogs','page','owners'));
+        $isTotalStock=true;
+        return view('inventory.statement.changeInventory',compact('oracleActTransactingLogs','page','owners','isTotalStock'));
     }
     public function exportData(Request $request){
         if(!Gate::allows("库存管理-库存")){ return redirect(url('/'));  }
@@ -153,8 +204,8 @@ class InventoryController extends Controller
                 'sku_Descr_C'=>$oracleActTransactingLogs[$i]['商品名称'],
                 'LotAtt08'=>$oracleActTransactingLogs[$i]['质量状态'],
                 'LotAtt04'=>$oracleActTransactingLogs[$i]['批号'],
-                'come_sum'=>$oracleActTransactingLogs[$i]['移出数量'],
-                'join_sum'=>$oracleActTransactingLogs[$i]['移入数量'],
+                'come_sum'=>isset($oracleActTransactingLogs[$i]['移出数量'])?$oracleActTransactingLogs[$i]['移出数量']:'',
+                'join_sum'=>isset($oracleActTransactingLogs[$i]['移入数量'])?$oracleActTransactingLogs[$i]['移入数量']:'',
                 'QTY'=>$oracleActTransactingLogs[$i]['在库数量'],
                 'QtyAllocated'=>$oracleActTransactingLogs[$i]['占用数量'],
             ];
@@ -163,118 +214,29 @@ class InventoryController extends Controller
         return Excel::download(new Export($row,$list),date('YmdHis', time()).'-动库报表单.xlsx');
     }
 
-
-
-
-
-    //创建盘点任务
-    public function createStockInventoryMission(Request $request){
-        if(!Gate::allows("库存管理-盘点")){ return redirect(url('/'));  }
-        $date_start=$request->input('formData.date_start');
-        $date_end=$request->input('formData.date_end');
-        $ownerId=$request->input('formData.owner_id')[0];
-        $inventory=app('inventoryService')->createMission($date_start,$date_end,$ownerId);
-        $inventory=Inventory::with('owner')->find($inventory->id);
-        if (is_null($inventory)) return ['success'=>false,'data'=>'参数错误!'];
-        return ['success'=>true,'data'=>$inventory];
-    }
-    //删除盘点任务
-    public function deleteStockInventoryMission($id){
-        if(!Gate::allows('库存管理-盘点')){return['success'=>0,'status'=>'没有权限'];}
-        if(is_null($id)){return ['success'=>false,'data'=>'传入id为空'];}
-        $inventory=Inventory::where('id',$id)->delete();
-        return ['success'=>true,'data'=>$inventory];
-    }
-    //盘点-任务页面
-    public function mission(Request $request){
-        if(!Gate::allows("库存管理-盘点")){ return redirect(url('/'));  }
-        $paginateParams = $request->input();
-        $queryParam=$request->all();
-        $inventories=app('inventoryService')->paginate($queryParam);
-        $owners=Owner::select('id','name')->get();
-        return view('inventory.stockInventory.mission',compact('owners','inventories','paginateParams'));
-    }
-    //进入盘点中或复盘页面
-    public function enterStockInventory($id){
-        if (!Gate::allows('库存管理-盘点')){return redirect(url('/')); }
-        if (!$id) return ['success'=>false,'data'=>'参数错误!'];
-        $inventory=Inventory::with('owner')->find($id);
-        $inventoryMissions=InventoryMission::with(['commodity'=>function($query){
-           return $query->with(['barcodes']);
-        }])->where('inventory_id',$id)->orderBy('difference_amount','desc')->get();
-//        ->whereHas('commodity',function ($query)use($inventory){
-//            return $query->where('owner_id',$inventory->owner_id);
-//        })
-        return view('inventory.stockInventory.inventoryMission',compact('inventory','inventoryMissions'));
-    }
-    //依据盘点任务id进行 --盘点
-    public function stockInventory(Request $request){
-        if (!Gate::allows('库存管理-盘点')){return redirect(url('/')); }
-        $location=$request->input('location');
-        $barcode=$request->input('barcode');
-        $inventoryId=$request->input('inventoryId');
-        $count=$request->input('count');
-        if (is_null($count)) return ['success'=>false,'data'=>'盘点数不能为空!'];
-        $inventoryMission=app('inventoryService')->stockInventory($location,$barcode,$count,$inventoryId);
-        if (!$inventoryMission)return ['success'=>false,'data'=>'参数错误!'];
-        $inventory=app('inventoryService')->updateInventory($inventoryId);
-        return ['success'=>true,'inventoryMission'=>$inventoryMission,'inventory'=>$inventory];
-    }
-    //根据该库存和产品条码查询该条盘点记录
-    public function searchStockInventoryRecord(Request $request){
-        if (!Gate::allows('库存管理-盘点')){return redirect(url('/')); }
-        $location=$request->input('location');
-        $barcode=$request->input('barcode');
-        $inventoryId=$request->input('inventoryId');
-        $inventoryMission=app('inventoryService')->searchStockInventoryRecord($location,$barcode,$inventoryId);
-        if (!$inventoryMission)return ['success'=>false,'data'=>'参数错误!'];
-        return ['success'=>true,'data'=>$inventoryMission];
+    /*
+     *  库存体积
+     */
+    function dailyLog(Request $request,OwnerService $ownerService){
+        if (!Gate::allows('库存管理-库存体积')){return redirect(url('/')); }
+        $inventoryDailyLogs = app('inventoryService')->getInventoryDailyLog($request->input());
+        $owners = $ownerService->getSelection();
+        $param = $request->input();
+        return view('inventory.statement.dailyLog',compact('inventoryDailyLogs','owners','param'));
     }
 
-    //盘点任务导出
-    public function stockInventoryExport(Request $request){
-        if (!Gate::allows('库存管理-盘点')){return redirect(url('/')); }
-        ini_set('max_execution_time',3500);
-        ini_set('memory_limit','3526M');
-        if ($request->checkAllSign){
-            $request->offsetUnset('checkAllSign');
-            $queryParam=$request->all();
-            $inventories=app('inventoryService')->get($queryParam);
-        }else{
-            $queryParam=$request->all();
-            $inventories=app('inventoryService')->some($queryParam);
-        }
-        $row=[[
-            'id'=>'盘点编号',
-            'created_at'=>'创建时间',
-            'owner_id'=>'货主',
-            'type'=>'任务类型',
-            'start_at'=>'起始时间',
-            'end_at'=>'结束时间',
-            'total'=>'记录数',
-            'processed'=>'已盘数',
-            'surplus'=>'剩余数',
-            'difference'=>'复盘差异',
-            'returned'=>'复盘归位',
-        ]];
-        $list=[];
-        for ($i=0; $i<count($inventories);$i++){
-            $inventory=$inventories[$i];
-            $w=[
-                'id'=>isset($inventory->id)?$inventory->id:'',
-                'created_at'=>isset($inventory->created_at)?$inventory->created_at:'',
-                'owner_id'=>isset($inventory->owner->name)?$inventory->owner->name:'',
-                'type'=>isset($inventory->type)?$inventory->type:'',
-                'start_at'=>isset($inventory->start_at)?$inventory->start_at:'',
-                'end_at'=>isset($inventory->end_at)?$inventory->end_at:'',
-                'total'=>isset($inventory->total)?$inventory->total:'',
-                'processed'=>isset($inventory->processed)?$inventory->processed:'',
-                'surplus'=>isset($inventory->surplus)?$inventory->surplus:'',
-                'difference'=>isset($inventory->difference)?$inventory->difference:'',
-                'returned'=>isset($inventory->returned)?$inventory->returned:'',
-            ];
-            $list[$i]=$w;
-        }
-        return Excel::download(new Export($row,$list),date('YmdHis', time()).'-盘点任务记录单.xlsx');
+    //获取记录监听货主
+    function getLoggingOwner(){
+        $loggingOwners = app('inventoryService')->getInventoryDailyLoggingOwner('owner_id');
+        return array_column($loggingOwners->toArray(),'owner_id');
+    }
+    //添加记录监听货主
+    function addLoggingOwner(Request $request){
+        if (!Gate::allows('库存管理-库存体积-管理监听货主')){return redirect(url('/')); }
+        $owner_id = $request->owner_id;
+        if (!$owner_id || !is_numeric($owner_id))return ['success'=>false,'data'=>'传递参数错误!'];
+        $loggingOwner = app('inventoryService')->firstOrCreate(['owner_id'=>$owner_id]);
+        if (!$loggingOwner)return ['success'=>false,'data'=>'录入失败!'];
+        return ['success'=>true,'data'=>$loggingOwner->owner_id];
     }
 }

+ 9 - 9
app/Http/Controllers/InventoryMissionController.php

@@ -2,7 +2,7 @@
 
 namespace App\Http\Controllers;
 
-use App\InventoryMission;
+use App\InventoryAccountMission;
 use Illuminate\Http\Request;
 
 class InventoryMissionController extends Controller
@@ -41,10 +41,10 @@ class InventoryMissionController extends Controller
     /**
      * Display the specified resource.
      *
-     * @param  \App\InventoryMission  $inventoryMission
+     * @param  \App\InventoryAccountMission  $inventoryMission
      * @return \Illuminate\Http\Response
      */
-    public function show(InventoryMission $inventoryMission)
+    public function show(InventoryAccountMission $inventoryMission)
     {
         //
     }
@@ -52,10 +52,10 @@ class InventoryMissionController extends Controller
     /**
      * Show the form for editing the specified resource.
      *
-     * @param  \App\InventoryMission  $inventoryMission
+     * @param  \App\InventoryAccountMission  $inventoryMission
      * @return \Illuminate\Http\Response
      */
-    public function edit(InventoryMission $inventoryMission)
+    public function edit(InventoryAccountMission $inventoryMission)
     {
         //
     }
@@ -64,10 +64,10 @@ class InventoryMissionController extends Controller
      * Update the specified resource in storage.
      *
      * @param  \Illuminate\Http\Request  $request
-     * @param  \App\InventoryMission  $inventoryMission
+     * @param  \App\InventoryAccountMission  $inventoryMission
      * @return \Illuminate\Http\Response
      */
-    public function update(Request $request, InventoryMission $inventoryMission)
+    public function update(Request $request, InventoryAccountMission $inventoryMission)
     {
         //
     }
@@ -75,10 +75,10 @@ class InventoryMissionController extends Controller
     /**
      * Remove the specified resource from storage.
      *
-     * @param  \App\InventoryMission  $inventoryMission
+     * @param  \App\InventoryAccountMission  $inventoryMission
      * @return \Illuminate\Http\Response
      */
-    public function destroy(InventoryMission $inventoryMission)
+    public function destroy(InventoryAccountMission $inventoryMission)
     {
         //
     }

+ 37 - 3
app/Http/Controllers/OrderController.php

@@ -11,7 +11,6 @@ use Illuminate\Http\Request;
 use Illuminate\Support\Facades\Auth;
 use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\Gate;
-use Illuminate\Support\Facades\Http;
 use Maatwebsite\Excel\Facades\Excel;
 
 class OrderController extends Controller
@@ -30,8 +29,26 @@ class OrderController extends Controller
         $notes=$request->input('notes');
         $addtime=$request->input('addtime');
         $waveno=$request->input('waveno');
+        $alternate_sku1=$request->input('alternate_sku1');
         $edisendflag2=$request->edisendflag2;
         $edisendflag=$request->edisendflag;
+        if ($alternate_sku1){
+            if ($request->checkAllSign) $detailsOrderno = $this->getOrdersNo($alternate_sku1,false);
+            else $detailsOrderno = $this->getOrdersNo($alternate_sku1,true, $request->page ?? 1, $request->paginate ?? 50);
+            if (count($detailsOrderno)>0){
+                $sql.=' AND orderno IN (';
+                foreach ($detailsOrderno as $index => $no){
+                    if ($index==0){
+                        $sql.="'".$no."'";
+                        continue;
+                    }
+                    $sql.=",'".$no."'";
+                }
+                $sql.=')';
+            }else{
+                $sql .= 'AND orderno IS NULL ';
+            }
+        }
         if ($orderdate_start && $orderdate_end && $addtime){
             $request->offsetUnset('orderdate_start');$request->offsetUnset('orderdate_end');
             $orderdate_start=null;
@@ -129,8 +146,10 @@ class OrderController extends Controller
         if(!Gate::allows('订单管理-查询')){ return redirect(url('/'));  }
         $paginate=$request->input('paginate')??50;
         $page=$request->input('page')??1;
+        if ($request->alternate_sku1){
+            $page = 1;$paginate=50;
+        }
         $checkData=$request->input('data');
-        $alternate_sku1=$request->input('alternate_sku1');
         $export=$request->input('checkAllSign');
         $sql="select ACT_ALLOCATION_DETAILS.picktotraceid,ACT_ALLOCATION_DETAILS.CHECKTIME,DOC_ORDER_HEADER.addtime,DOC_ORDER_HEADER.C_PROVINCE,DOC_ORDER_HEADER.C_CITY,DOC_ORDER_HEADER.C_DISTRICT,DOC_ORDER_HEADER.C_CONTACT,DOC_ORDER_HEADER.OrderNo,DOC_ORDER_HEADER.SOStatus,DOC_ORDER_HEADER.WAREHOUSEID,DOC_ORDER_HEADER.CustomerID
         ,DOC_ORDER_HEADER.C_Tel2,DOC_ORDER_HEADER.CarrierName,DOC_ORDER_HEADER.IssuePartyName,DOC_ORDER_HEADER.EDIREMARKS2,
@@ -174,7 +193,6 @@ class OrderController extends Controller
                       left join  BAS_SKU on DOC_Order_Details.CustomerID=BAS_SKU.CustomerID and DOC_Order_Details.SKU=BAS_SKU.SKU
                       left join ACT_ALLOCATION_DETAILS on DOC_Order_Details.orderno=ACT_ALLOCATION_DETAILS.orderno and
                       DOC_Order_Details.orderlineno=ACT_ALLOCATION_DETAILS.orderlineno";
-        if ($alternate_sku1)$sql.=" where BAS_SKU.Alternate_SKU1 like '".$alternate_sku1."%'";
         $orders=DB::connection('oracle')->select(DB::raw($sql));
         $commodities=[];
         $picktotraceids=[];
@@ -206,10 +224,26 @@ class OrderController extends Controller
         $commodities=new Collection($commodities);
         if ($checkData || $export)return $this->export($orders,$commodities);
         $customers=OracleBasCustomer::query()->select('customerid','descr_c')->where('customer_type','OW')->where('active_flag','Y')->get();
+        $page = $request->page ?? 1;
         $request=$request->input();
         $codes=DB::connection('oracle')->table('BAS_CODES')->select('code','codename_c')->where('codeid','SO_STS')->orderBy('code','asc')->get();
         return view('order/index/delivering',compact('orders','customers','request','codes','commodities','page','picktotraceids'));
     }
+    //通过商品条码获取订单编号
+    public function getOrdersNo($alternate_sku1, $isPaging = true, $page = 1, $paginate = 50){
+        if ($isPaging){
+            $sql = "SELECT RESULT.ORDERNO FROM 
+                        (SELECT ROWNUM rn,DETAIL.ORDERNO as ORDERNO FROM
+                            (SELECT ORDERNO FROM DOC_ORDER_DETAILS WHERE SKU LIKE '".$alternate_sku1."' GROUP BY ORDERNO ORDER BY ORDERNO DESC)DETAIL
+                        WHERE ROWNUM<='".$page*$paginate."')RESULT 
+                    WHERE RESULT.rn>'".($page-1)*$paginate."'";
+        }else {
+            $sql = "SELECT ORDERNO FROM DOC_ORDER_DETAILS WHERE SKU LIKE '".$alternate_sku1."' GROUP BY ORDERNO ORDER BY ORDERNO DESC";
+        }
+        $orderDetails = DB::connection('oracle')->select(DB::raw($sql));
+        return array_column($orderDetails,'orderno');
+    }
+
     //批量备注追加
     public function batchComments(Request $request){
         if(!Gate::allows('订单管理-批量备注')){ return redirect(url('/'));  }

+ 4 - 0
app/Http/Controllers/TestController.php

@@ -272,6 +272,10 @@ class TestController extends Controller
     /*1*/
     function test(Request $request)
     {/**/
+        $a = new OrderController();
+        $alternate_sku1 = '8003340090276';
+        dd($a -> getOrdersNo($alternate_sku1));
+
         $units=ProcessesContent::with('signCommodity')->get();
         foreach ($units as $unit){
             if ($unit->sign_commodity_name_mark)dd($unit->sign_commodity_name_mark);

+ 7 - 6
app/Inventory.php → app/InventoryAccount.php

@@ -6,7 +6,7 @@ use App\Traits\ModelTimeFormat;
 use Illuminate\Database\Eloquent\Model;
 use Illuminate\Database\Eloquent\SoftDeletes;
 
-class Inventory extends Model
+class InventoryAccount extends Model
 {
     use ModelTimeFormat;
     use SoftDeletes;
@@ -20,7 +20,7 @@ class Inventory extends Model
         return $this->belongsTo('App\Owner','owner_id','id');
     }
     public function inventoryMissions(){
-        return $this->belongsTo('App\InventoryMission','id','inventory_id');
+        return $this->belongsTo('App\InventoryAccountMission','id','inventory_account_id');
     }
 
     public function getSurplusAttribute()
@@ -28,19 +28,20 @@ class Inventory extends Model
         return $this['total'] ? $this['total']-$this['processed']:0;
     }
     public function getProcessedAmount(){
-        return $this->inventoryMissions()->where('checked','是')->where('inventory_id',$this['id'])->count();
+        return $this->inventoryMissions()->where('checked','是')->where('inventory_account_id',$this['id'])->count();
     }
     //复盘剩余数
     public function getCheckSurplusAttribute()
     {
-        $re_checked_amount=$this->inventoryMissions()->where('inventory_id',$this['id'])->whereNotNull('re_checked_amount')->count();
+        $re_checked_amount=$this->inventoryMissions()->where('inventory_account_id',$this['id'])->whereNotNull('re_checked_amount')->count();
         return $this['total'] ? $this['total']-$re_checked_amount:null;
     }
     public function getDifferenceAmount(){
-        return $this->inventoryMissions()->where('inventory_id',$this['id'])->where('difference_amount','>',0)->count();
+        return $this->inventoryMissions()->where('inventory_account_id',$this['id'])->where('difference_amount','>',0)->count();
     }
+    //复盘归位
     public function getReturnedAmount(){
-        return $this->inventoryMissions()->where('inventory_id',$this['id'])->where('returned','是')->count();
+        return $this->inventoryMissions()->where('inventory_account_id',$this['id'])->where('returned','是')->count();
 
     }
 }

+ 2 - 2
app/InventoryMission.php → app/InventoryAccountMission.php

@@ -4,10 +4,10 @@ namespace App;
 
 use Illuminate\Database\Eloquent\Model;
 
-class InventoryMission extends Model
+class InventoryAccountMission extends Model
 {
     protected $fillable=[
-        'id','inventory_id','location','commodity_id', 'produced_at', 'valid_at','stored_at','batch_number','erp_type_position','quality','stored_amount','valid_amount',
+        'id','inventory_account_id','location','commodity_id', 'produced_at', 'valid_at','stored_at','batch_number','erp_type_position','quality','stored_amount','valid_amount',
         'verified_amount','re_checked_amount','difference_amount','occupied_amount','checked',
     ];
     public function commodity(){

+ 20 - 0
app/InventoryDailyLog.php

@@ -0,0 +1,20 @@
+<?php
+
+namespace App;
+
+use Illuminate\Database\Eloquent\Model;
+
+class InventoryDailyLog extends Model
+{
+    public $timestamps=false;
+    protected $fillable=[
+        'owner_id','created_at','commodity_id','amount','volumn_occupied'
+    ];
+
+    public function owner(){
+        return $this->hasOne('App\Owner','id','owner_id')->select('id','name');
+    }
+    public function commodity(){
+        return $this->hasOne('App\Commodity','id','commodity_id');
+    }
+}

+ 16 - 0
app/InventoryDailyLoggingOwner.php

@@ -0,0 +1,16 @@
+<?php
+
+namespace App;
+
+use Illuminate\Database\Eloquent\Model;
+
+class InventoryDailyLoggingOwner extends Model
+{
+    protected $fillable=[
+        "owner_id","status"
+    ];
+
+    public function owner(){
+        return $this->hasOne('App\Owner','id','owner_id');
+    }
+}

+ 18 - 0
app/Services/CommodityService.php

@@ -0,0 +1,18 @@
+<?php 
+
+namespace App\Services; 
+
+use App\Commodity;
+
+Class CommodityService
+{ 
+    public function firstOrCreate($param,$column = null){
+        if ($column) return Commodity::query()->firstOrCreate($param,$column);
+        return Commodity::query()->firstOrCreate($param);
+    }
+    public function updateOrCreate($param,$column = null){
+        if ($column) return Commodity::query()->updateOrCreate($param,$column);
+        return Commodity::query()->updateOrCreate($param);
+    }
+
+}

+ 238 - 0
app/Services/InventoryAccountService.php

@@ -0,0 +1,238 @@
+<?php
+
+
+namespace App\Services;
+
+use App\Commodity;
+use App\Http\Controllers\Controller;
+use App\InventoryAccount;
+use App\InventoryAccountMission;
+use App\OraccleBasCustomer;
+use App\OracleActTransactionLog;
+use App\OracleInvLotLocId;
+use App\Owner;
+use App\Services\common\QueryService;
+use Illuminate\Http\Request;
+use Illuminate\Support\Collection;
+use Illuminate\Support\Facades\Auth;
+use Illuminate\Support\Facades\DB;
+use Illuminate\Support\Facades\Gate;
+
+class InventoryAccountService
+{
+
+    private function conditionQuery($queryParam){
+        $inventories=InventoryAccount::query()->with(['owner'])->orderBy('id','desc');
+        $columnQueryRules=[
+            'owner_id' => ['multi' => ','],
+            'date_start' => ['alias' => 'created_at' , 'startDate' => ' 00:00:00'],
+            'date_end' => ['alias' => 'created_at' , 'endDate' => ' 23:59:59'],
+        ];
+        $inventories = app(QueryService::class)->query($queryParam,$inventories,$columnQueryRules);
+        return $inventories;
+    }
+    public function paginate($queryParam){
+        $inventories = $this->conditionQuery($queryParam);
+        return $inventories->paginate($queryParam['paginate'] ?? 50);
+    }
+
+    public function get($queryParam){
+        $inventories = $this->conditionQuery($queryParam);
+        return $inventories->get();
+    }
+
+    public function some($queryParam){
+        return InventoryAccount::query()->with(['owner'])->orderBy('id','DESC')
+            ->whereIn('id',explode(',',$queryParam['data']))->get();
+    }
+    //动盘查询
+    public function conditionPortStock($date_start,$date_end,$ownerId){
+        if (!$ownerId) return null;
+        $descr_c=Owner::where('id',$ownerId)->value('name');
+        $sql='select * from (select result.*,rownum rn from (';
+        $sql.=' select customer.Descr_C as 货主,stockLog.客户 客户, 库位, sku.SKU 产品编码, sku.ALTERNATE_SKU1 产品条码, ';
+        $sql.=' sku.Descr_C 商品名称, lot.LotAtt05 属性仓, lot.LotAtt08 质量状态, lot.LotAtt02 失效日期, ';
+        $sql.=' lot.LotAtt04 批号, lot.LotAtt01 生产日期, lot.LotAtt03 入库日期';
+        $sql.=' , sum(移出数量)移出数量, sum(移入数量)移入数量 ';
+        $sql.=' , storeStatus.QTY 在库数量, storeStatus.QtyAllocated 占用数量,count(1) over () as sum from ';
+        $sql.=' (select FMLotNum,FMSKU,TOCustomerID 客户,0 as 移出数量, sum(TOQty_Each) as 移入数量, TOLocation as 库位 ';
+        $sql.=" from ACT_Transaction_Log where TransactionType='PA' ";
+        if ($date_start) $sql.=" and addtime > to_date('".$date_start." 00:00:00','yyyy-mm-dd hh24:mi:ss') ";
+        if ($date_end) $sql.=" and addtime < to_date('".$date_end." 23:59:59','yyyy-mm-dd hh24:mi:ss') ";
+        $sql.=' group by TOCustomerID, TOLocation,FMSKU,FMLotNum union all ';
+        $sql.=' select FMLotNum,FMSKU,FMCUSTOMERID 客户,sum(FMQty_Each) as 移出数量, 0 as 移入数量, FMLOCATION as 库位 ';
+        $sql.=" from ACT_Transaction_Log where TransactionType='SO' ";
+        if ($date_start) $sql.=" and addtime > to_date('".$date_start." 00:00:00','yyyy-mm-dd hh24:mi:ss') ";
+        if ($date_end) $sql.=" and addtime < to_date('".$date_end." 23:59:59','yyyy-mm-dd hh24:mi:ss') ";
+        $sql.=' group by FMCustomerID, FMLocation,FMSKU,FMLotNum union all ';
+        $sql.=' select FMLotNum,FMSKU,FMCUSTOMERID 客户,sum(FMQty_Each) as 移出数量,0 as 移入数量, FMLocation as 库位 ';
+        $sql.=" from ACT_Transaction_Log  where TransactionType='MV' ";
+        if ($date_start) $sql.=" and addtime > to_date('".$date_start." 00:00:00','yyyy-mm-dd hh24:mi:ss') ";
+        if ($date_end) $sql.=" and addtime < to_date('".$date_end." 23:59:59','yyyy-mm-dd hh24:mi:ss') ";
+        $sql.=' group by FMLocation,FMCUSTOMERID,FMSKU,FMLotNum union all ';
+        $sql.=' select FMLotNum,FMSKU,TOCustomerID 客户,0 as 移出数量,sum(TOQty_Each)as 移入数量, TOLocation as 库位 ';
+        $sql.=" from ACT_Transaction_Log where TransactionType='MV' ";
+        if ($date_start) $sql.=" and addtime > to_date('".$date_start." 00:00:00','yyyy-mm-dd hh24:mi:ss') ";
+        if ($date_end) $sql.=" and addtime < to_date('".$date_end." 23:59:59','yyyy-mm-dd hh24:mi:ss') ";
+        $sql.=' group by TOLocation,TOCustomerID,FMSKU,FMLotNum)stockLog ';
+        $sql.=' left join BAS_Customer customer on customer.CustomerID=stockLog.客户 ';
+        $sql.=' left join BAS_SKU sku on sku.SKU=stockLog.FMSKU and sku.CUSTOMERID=stockLog.客户 ';
+        $sql.=' left join INV_LOT_ATT lot on lot.LOTNUM=stockLog.FMLOTNUM ';
+        $sql.=' left join INV_LOT_LOC_ID storeStatus on storeStatus.LOTNUM=stockLog.FMLOTNUM ';;
+        $sql.=' and storeStatus.LocationID=stockLog.库位 ';
+        $sql.=' group by 库位,customer.Descr_C,sku.SKU,sku.ALTERNATE_SKU1 ';
+        $sql.=' ,sku.Descr_C,FMLotNum,lot.LotAtt05,lot.LotAtt01,lot.LotAtt03,lot.LotAtt08,lot.LotAtt02,lot.LotAtt04 ';
+        $sql.=' , storeStatus.QTY, storeStatus.QtyAllocated,stockLog.客户  ';
+        $sql.=' )result where 1=1 ';
+        if ($descr_c){
+            $sql .= ' and 货主 in (';
+            $descr_cs = explode(',',$descr_c);
+            foreach ($descr_cs as $index => $descr_c){
+                if ($index != 0)$sql .= ',';
+                $sql .= "'".$descr_c."'";
+            }
+            $sql .= ') ';
+        }
+        $sql.=' )  ';
+        return DB::connection('oracle')->select($sql);
+    }
+    //全盘查询
+    private function conditionTotalStock($ownerId){
+        $descr_c=Owner::where('id',$ownerId)->value('name');
+        $sql='select * from (select result.*,rownum rn from (';
+        $sql.=' select customer.Descr_C as 货主,storeStatus.CUSTOMERID 客户,storeStatus.LocationID 库位, sku.SKU 产品编码, sku.ALTERNATE_SKU1 产品条码, ';
+        $sql.=' sku.Descr_C 商品名称, lot.LotAtt05 属性仓, lot.LotAtt08 质量状态, lot.LotAtt02 失效日期, storeStatus.ADDTIME 创建时间, ';
+        $sql.=' lot.LotAtt04 批号,lot.LotAtt01 生产日期,lot.LotAtt03 入库日期 ';
+        $sql.=' , storeStatus.QTY 在库数量, storeStatus.QtyAllocated 占用数量,count(1) over () as sum from ';
+        $sql.=' INV_LOT_LOC_ID storeStatus';
+        $sql.=' left join BAS_Customer customer on customer.CustomerID=storeStatus.CUSTOMERID ';
+        $sql.=' left join BAS_SKU sku on sku.SKU=storeStatus.SKU and sku.CUSTOMERID=storeStatus.CUSTOMERID ';
+        $sql.=' left join INV_LOT_ATT lot on lot.LOTNUM = storeStatus.LOTNUM AND lot.CUSTOMERID = storeStatus.CUSTOMERID ';
+        $sql.=' group by storeStatus.LocationID,customer.Descr_C,sku.SKU,sku.ALTERNATE_SKU1 ';
+        $sql.=' ,sku.Descr_C,lot.LotAtt05,lot.LotAtt08,lot.LotAtt02,lot.LotAtt04 ';
+        $sql.=' , storeStatus.QTY, storeStatus.QtyAllocated,storeStatus.CUSTOMERID,storeStatus.ADDTIME,lot.LotAtt01,lot.LotAtt03  ';
+        $sql.=' )result where 1=1 ';
+        if ($descr_c)$sql.=" and 货主 = '".$descr_c."' ";
+        $sql.=' )  ';
+        return DB::connection('oracle')->select($sql);
+    }
+    //创建盘点任务
+    public function createMission($date_start,$date_end,$ownerId){
+        if (!$ownerId) return null;
+        if ($date_start&&$date_end){
+            $date_end_time=$date_end.' 23:59:59';
+            $type='动盘';
+            $wmsInventories=$this->conditionPortStock($date_start,$date_end,$ownerId);
+        }elseif (!$date_start&&!$date_end){
+            $name=Owner::where('id',$ownerId)->value('name');
+            $ownerName=OraccleBasCustomer::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='全盘';
+            $wmsInventories=$this->conditionTotalStock($ownerId);
+        }else{
+            return null;
+        }
+        $inventory=new InventoryAccount([
+            'owner_id'=>$ownerId,
+            'type'=>$type,
+            'start_at'=>$date_start,
+            'end_at'=>$date_end_time,
+            'total'=>count($wmsInventories),
+        ]);
+        $inventory->save();
+        $this->createInventoryAccountMissionRecord($ownerId,$inventory['id'],$wmsInventories);
+        $request=[
+            'date_start'=>$date_start,
+            'date_end'=>$date_end,
+            'ownerId'=>$ownerId,
+            'inventoryId'=>$inventory['id'],
+        ];
+        Controller::logS(__METHOD__,"创建盘点任务__".__FUNCTION__,json_encode($request),Auth::user()['id']);
+        return $inventory;
+    }
+
+    //创建盘点记录任务
+    public function createInventoryAccountMissionRecord($ownerId,$inventoryAccountId,$wmsInventories){
+        $inventoryAccountMissions=[];
+        foreach ($wmsInventories as $wmsInventory){
+            $commodity=Commodity::query()->firstOrCreate([
+                'owner_id'=>$ownerId,
+                'sku'=>$wmsInventory->产品编码,
+                'name'=>$wmsInventory->商品名称,
+            ]);
+            Controller::logS(__METHOD__,"根据wms产品编码和货主查询或创建商品信息__".__FUNCTION__,json_encode($wmsInventory));
+            $commodity->newBarcode($wmsInventory->产品条码);
+            Controller::logS(__METHOD__,"根据wms产品条码和商品id查询或创建商品条码信息__".__FUNCTION__,json_encode($wmsInventory));
+            $inventoryAccountMission=[
+            'commodity_id'=>$commodity->id,
+            'inventory_account_id'=>$inventoryAccountId,
+            'location'=>$wmsInventory->库位,
+            'produced_at'=>$wmsInventory->生产日期,
+            'valid_at'=>$wmsInventory->失效日期,
+            'stored_at'=>$wmsInventory->入库日期,
+            'batch_number'=>$wmsInventory->批号,
+            'erp_type_position'=>$wmsInventory->属性仓,
+            'quality'=>$wmsInventory->质量状态,
+            'stored_amount'=>$wmsInventory->在库数量,
+            'occupied_amount'=>$wmsInventory->占用数量,
+            'valid_amount'=>$wmsInventory->在库数量-$wmsInventory->占用数量,
+            ];
+            array_push($inventoryAccountMissions,$inventoryAccountMission);
+        }
+        DB::table('inventory_account_missions')->insert($inventoryAccountMissions);
+    }
+    //盘点库存
+    public function stockInventory($location,$barcode,$count,$inventoryAccountId){
+
+        $inventoryAccountMission=InventoryAccountMission::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();
+        if (!$inventoryAccountMission) return null;
+        $inventory=InventoryAccount::find($inventoryAccountId);
+        if ($inventory->surplus!=0){
+            $inventoryAccountMission->verified_amount=$count;
+            $inventoryAccountMission->difference_amount=abs($inventoryAccountMission->stored_amount-$count);
+            $inventoryAccountMission->checked='是';
+        }else{
+            $inventoryAccountMission->re_checked_amount=$count;
+            $inventoryAccountMission->difference_amount=abs($inventoryAccountMission->stored_amount-$count);
+            if ($inventoryAccountMission->difference_amount==0){
+                $inventoryAccountMission->returned='是';
+            }else{
+                $inventoryAccountMission->returned='否';
+            }
+        }
+        $inventoryAccountMission->update();
+        $request=[
+            'location'=>$location,
+            'barcode'=>$barcode,
+            'count'=>$count,
+            'inventoryId'=>$inventoryAccountId,
+        ];
+        Controller::logS(__METHOD__,"盘点__".__FUNCTION__,json_encode($request));
+        return $inventoryAccountMission;
+    }
+    //盘点修改盘点任务数据
+    public function updateInventory($inventoryAccountId){
+        $inventoryAccount=InventoryAccount::find($inventoryAccountId);
+        $inventoryAccount->processed=$inventoryAccount->getProcessedAmount();
+        $inventoryAccount->difference=$inventoryAccount->getDifferenceAmount();
+        $inventoryAccount->returned=$inventoryAccount->getReturnedAmount();
+        $inventoryAccount->update();
+        Controller::logS(__METHOD__,"盘点修改盘点任务中的已盘条数__".__FUNCTION__,json_encode($inventoryAccountId));
+        return $inventoryAccount;
+    }
+    //根据该库存和产品条码查询该条盘点记录
+    public function searchStockInventoryRecord($location,$barcode,$inventoryAccountId){
+        $inventoryAccountMission=InventoryAccountMission::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();
+        if (!$inventoryAccountMission) return null;
+        return  $inventoryAccountMission;
+    }
+}

+ 23 - 186
app/Services/InventoryService.php

@@ -6,13 +6,14 @@ namespace App\Services;
 use App\Commodity;
 use App\Http\Controllers\Controller;
 use App\Inventory;
+use App\inventoryDailyLog;
+use App\InventoryDailyLoggingOwner;
 use App\InventoryMission;
 use App\OraccleBasCustomer;
 use App\OracleActTransactionLog;
 use App\Owner;
 use App\Services\common\QueryService;
 use Illuminate\Http\Request;
-use Illuminate\Support\Collection;
 use Illuminate\Support\Facades\Auth;
 use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\Gate;
@@ -20,201 +21,37 @@ use Illuminate\Support\Facades\Gate;
 class InventoryService
 {
 
-    private function conditionQuery($queryParam){
-        $inventories=Inventory::query()->with(['owner'])->orderBy('id','desc');
+    //库存体积条件
+    private function conditionQueryDailyLog(array $param){
+        $inventoryDailyLogs = InventoryDailyLog::query()->with(['owner','commodity'=>function($query){
+            $query->with('barcodes');
+        }])->orderByDesc('id');
         $columnQueryRules=[
             'owner_id' => ['multi' => ','],
-            'date_start' => ['alias' => 'created_at' , 'startDate' => ' 00:00:00'],
-            'date_end' => ['alias' => 'created_at' , 'endDate' => ' 23:59:59'],
+            'created_at_start' => ['alias' => 'created_at' , 'startDate' => ' 00:00:00'],
+            'created_at_end' => ['alias' => 'created_at' , 'endDate' => ' 23:59:59'],
         ];
-        $inventories = app(QueryService::class)->queryCondition($queryParam,$inventories,$columnQueryRules);
-        return $inventories;
-    }
-    public function paginate($queryParam){
-        $inventories = $this->conditionQuery($queryParam);
-        return $inventories->paginate($queryParam['paginate'] ?? 50);
-    }
+        $inventoryDailyLogs = app(QueryService::class)->query($param,$inventoryDailyLogs,$columnQueryRules);
+        return $inventoryDailyLogs;
 
-    public function get($queryParam){
-        $inventories = $this->conditionQuery($queryParam);
-        return $inventories->get();
     }
 
-    public function some($queryParam){
-        return Inventory::query()->with(['owner'])->orderBy('id','DESC')
-            ->whereIn('id',explode(',',$queryParam['data']))->get();
+    //库存体积
+    public function getInventoryDailyLog(array $param){
+        return $this->conditionQueryDailyLog($param)->paginate($param['paginate'] ?? 50);
     }
 
-    public function conditionSearch($date_start,$date_end,$ownerId){
-        if (!$ownerId) return null;
-        $descr_c=Owner::where('id',$ownerId)->value('name');
-        $sql='select * from (select result.*,rownum rn from (';
-        $sql.=' select customer.Descr_C as 货主,stockLog.客户 客户, 库位, sku.SKU 产品编码, sku.ALTERNATE_SKU1 产品条码, ';
-        $sql.=' sku.Descr_C 商品名称, lot.LotAtt05 属性仓, lot.LotAtt08 质量状态, lot.LotAtt02 失效日期, ';
-        $sql.=' lot.LotAtt04 批号, lot.LotAtt01 生产日期, lot.LotAtt03 入库日期';
-        $sql.=' , sum(移出数量)移出数量, sum(移入数量)移入数量 ';
-        $sql.=' , storeStatus.QTY 在库数量, storeStatus.QtyAllocated 占用数量,count(1) over () as sum from ';
-        $sql.=' (select FMLotNum,FMSKU,TOCustomerID 客户,0 as 移出数量, sum(TOQty_Each) as 移入数量, TOLocation as 库位 ';
-        $sql.=" from ACT_Transaction_Log where TransactionType='PA' ";
-        if ($date_start) $sql.=" and addtime > to_date('".$date_start." 00:00:00','yyyy-mm-dd hh24:mi:ss') ";
-        if ($date_end) $sql.=" and addtime < to_date('".$date_end." 23:59:59','yyyy-mm-dd hh24:mi:ss') ";
-        $sql.=' group by TOCustomerID, TOLocation,FMSKU,FMLotNum union all ';
-        $sql.=' select FMLotNum,FMSKU,FMCUSTOMERID 客户,sum(FMQty_Each) as 移出数量, 0 as 移入数量, FMLOCATION as 库位 ';
-        $sql.=" from ACT_Transaction_Log where TransactionType='SO' ";
-        if ($date_start) $sql.=" and addtime > to_date('".$date_start." 00:00:00','yyyy-mm-dd hh24:mi:ss') ";
-        if ($date_end) $sql.=" and addtime < to_date('".$date_end." 23:59:59','yyyy-mm-dd hh24:mi:ss') ";
-        $sql.=' group by FMCustomerID, FMLocation,FMSKU,FMLotNum union all ';
-        $sql.=' select FMLotNum,FMSKU,FMCUSTOMERID 客户,sum(FMQty_Each) as 移出数量,0 as 移入数量, FMLocation as 库位 ';
-        $sql.=" from ACT_Transaction_Log  where TransactionType='MV' ";
-        if ($date_start) $sql.=" and addtime > to_date('".$date_start." 00:00:00','yyyy-mm-dd hh24:mi:ss') ";
-        if ($date_end) $sql.=" and addtime < to_date('".$date_end." 23:59:59','yyyy-mm-dd hh24:mi:ss') ";
-        $sql.=' group by FMLocation,FMCUSTOMERID,FMSKU,FMLotNum union all ';
-        $sql.=' select FMLotNum,FMSKU,TOCustomerID 客户,0 as 移出数量,sum(TOQty_Each)as 移入数量, TOLocation as 库位 ';
-        $sql.=" from ACT_Transaction_Log where TransactionType='MV' ";
-        if ($date_start) $sql.=" and addtime > to_date('".$date_start." 00:00:00','yyyy-mm-dd hh24:mi:ss') ";
-        if ($date_end) $sql.=" and addtime < to_date('".$date_end." 23:59:59','yyyy-mm-dd hh24:mi:ss') ";
-        $sql.=' group by TOLocation,TOCustomerID,FMSKU,FMLotNum)stockLog ';
-        $sql.=' left join BAS_Customer customer on customer.CustomerID=stockLog.客户 ';
-        $sql.=' left join BAS_SKU sku on sku.SKU=stockLog.FMSKU and sku.CUSTOMERID=stockLog.客户 ';
-        $sql.=' left join INV_LOT_ATT lot on lot.LOTNUM=stockLog.FMLOTNUM ';
-        $sql.=' left join INV_LOT_LOC_ID storeStatus on storeStatus.LOTNUM=stockLog.FMLOTNUM ';;
-        $sql.=' and storeStatus.LocationID=stockLog.库位 ';
-        $sql.=' group by 库位,customer.Descr_C,sku.SKU,sku.ALTERNATE_SKU1 ';
-        $sql.=' ,sku.Descr_C,FMLotNum,lot.LotAtt05,lot.LotAtt01,lot.LotAtt03,lot.LotAtt08,lot.LotAtt02,lot.LotAtt04 ';
-        $sql.=' , storeStatus.QTY, storeStatus.QtyAllocated,stockLog.客户  ';
-        $sql.=' )result where 1=1 ';
-        if ($descr_c){
-            $sql .= ' and 货主 in (';
-            $descr_cs = explode(',',$descr_c);
-            foreach ($descr_cs as $index => $descr_c){
-                if ($index != 0)$sql .= ',';
-                $sql .= "'".$descr_c."'";
-            }
-            $sql .= ') ';
-        }
-        $sql.=' )  ';
-        //dd($sql);
-        return DB::connection('oracle')->select($sql);
-    }
-    //创建盘点任务
-    public function createMission($date_start,$date_end,$ownerId){
-        if (!$ownerId) return null;
-        if ($date_start&&$date_end){
-            $date_end_time=$date_end.' 23:59:59';
-            $type='动盘';
-        }elseif (!$date_start&&!$date_end){
-            $name=Owner::where('id',$ownerId)->value('name');
-            $ownerName=OraccleBasCustomer::where('customer_type','OW')->where('active_flag','Y')->where('descr_c',$name)->value('customerid');
-            $date_start=OracleActTransactionLog::where('fmcustomerid',$ownerName)->orderBy('addtime','asc')->value('addtime');
-            $date_end_time=OracleActTransactionLog::where('fmcustomerid',$ownerName)->orderBy('addtime','desc')->value('addtime');
-            $type='全盘';
-        }else{
-            return null;
+    //获取开启监听记录货主
+    public function getInventoryDailyLoggingOwner($column = ['id','owner_id'], $status = "启用"){
+        if (!is_array($column)) {
+            $column = [$column];
         }
-        $inventory=new Inventory([
-            'owner_id'=>$ownerId,
-            'type'=>$type,
-            'start_at'=>$date_start,
-            'end_at'=>$date_end_time,
-        ]);
-        $inventory->save();
-        $this->createInventoryMissionRecord($date_start,$date_end,$ownerId,$inventory['id']);
-        $request=[
-            'date_start'=>$date_start,
-            'date_end'=>$date_end,
-            'ownerId'=>$ownerId,
-            'inventoryId'=>$inventory['id'],
-        ];
-        Controller::logS(__METHOD__,"创建盘点记录任务__".__FUNCTION__,json_encode($request),Auth::user()['id']);
-        $inventoryMissionCount=InventoryMission::where('inventory_id',$inventory['id'])->count();
-        $inventory->total=$inventoryMissionCount;
-        $inventory->update();
-        Controller::logS(__METHOD__,"创建盘点任务__".__FUNCTION__,json_encode($request),Auth::user()['id']);
-        return $inventory;
+        return InventoryDailyLoggingOwner::query()->select($column)->where('status',$status)->get();
     }
 
-    //创建盘点记录任务
-    public function createInventoryMissionRecord($date_start,$date_end,$ownerId,$inventoryId){
-        if (!$ownerId) return null;
-        $wmsInventories=$this->conditionSearch($date_start,$date_end,$ownerId);
-        foreach ($wmsInventories as $wmsInventory){
-            $commodity=Commodity::query()->firstOrCreate([
-                'owner_id'=>$ownerId,
-                'sku'=>$wmsInventory->产品编码,
-                'name'=>$wmsInventory->商品名称,
-            ]);
-            Controller::logS(__METHOD__,"根据wms产品编码和货主查询或创建商品信息__".__FUNCTION__,json_encode($wmsInventory));
-            $commodity->newBarcode($wmsInventory->产品条码);
-            Controller::logS(__METHOD__,"根据wms产品条码和商品id查询或创建商品条码信息__".__FUNCTION__,json_encode($wmsInventory));
-            $inventoryMission = new InventoryMission();
-            $inventoryMission->commodity_id=$commodity->id;
-            $inventoryMission->inventory_id=$inventoryId;
-            $inventoryMission->location=$wmsInventory->库位;
-            $inventoryMission->produced_at=$wmsInventory->生产日期;
-            $inventoryMission->valid_at=$wmsInventory->失效日期;
-            $inventoryMission->stored_at=$wmsInventory->入库日期;
-            $inventoryMission->batch_number=$wmsInventory->批号;
-            $inventoryMission->erp_type_position=$wmsInventory->属性仓;
-            $inventoryMission->quality=$wmsInventory->质量状态;
-            $inventoryMission->stored_amount=$wmsInventory->在库数量;
-            $inventoryMission->occupied_amount=$wmsInventory->占用数量;
-            $inventoryMission->save();
-        }
-
+    //录入监听记录货主
+    public function firstOrCreate($param,$column = null){
+        if ($column)return InventoryDailyLoggingOwner::query()->firstOrCreate($param,$column);
+        return InventoryDailyLoggingOwner::query()->firstOrCreate($param);
     }
-    //盘点库存
-    public function stockInventory($location,$barcode,$count,$inventoryId){
-
-        $inventoryMission=InventoryMission::whereHas('commodity',function($query)use($barcode){
-             $query->whereHas('barcodes',function($sql)use($barcode){
-                 $sql->where('code','=',$barcode);
-            });
-        })->where('location',$location)->where('inventory_id',$inventoryId)->first();
-        if (!$inventoryMission) return null;
-        $inventory=Inventory::find($inventoryId);
-        if ($inventory->surplus!=0){
-            $inventoryMission->verified_amount=$count;
-            $inventoryMission->difference_amount=abs($inventoryMission->stored_amount-$count);
-            $inventoryMission->checked='是';
-        }else{
-            $inventoryMission->re_checked_amount=$count;
-            $inventoryMission->difference_amount=abs($inventoryMission->stored_amount-$count);
-            if ($inventoryMission->difference_amount==0){
-                $inventoryMission->returned='是';
-            }else{
-                $inventoryMission->returned='否';
-            }
-        }
-        $inventoryMission->update();
-        $request=[
-            'location'=>$location,
-            'barcode'=>$barcode,
-            'count'=>$count,
-            'inventoryId'=>$inventoryId,
-        ];
-        Controller::logS(__METHOD__,"盘点__".__FUNCTION__,json_encode($request));
-        return $inventoryMission;
-    }
-    //盘点修改盘点任务数据
-    public function updateInventory($inventoryId){
-        $inventory=Inventory::find($inventoryId);
-        $inventory->processed=$inventory->getProcessedAmount();
-        $inventory->difference=$inventory->getDifferenceAmount();
-        $inventory->returned=$inventory->getReturnedAmount();
-        $inventory->update();
-        Controller::logS(__METHOD__,"盘点修改盘点任务中的已盘条数__".__FUNCTION__,json_encode($inventoryId));
-        return $inventory;
-    }
-    //根据该库存和产品条码查询该条盘点记录
-    public function searchStockInventoryRecord($location,$barcode,$inventoryId){
-        $inventoryMission=InventoryMission::whereHas('commodity',function($query)use($barcode){
-            $query->whereHas('barcodes',function($sql)use($barcode){
-                $sql->where('code',$barcode);
-            });
-        })->where('location',$location)->where('inventory_id',$inventoryId)->first();
-        if (!$inventoryMission) return null;
-        return  $inventoryMission;
-    }
-
-
 }

+ 1 - 1
app/Services/LaborReportService.php

@@ -43,7 +43,7 @@ class LaborReportService
             'created_at_end' => ['alias' => 'created_at' , 'endDate' => ' 23:59:59'],
             'identity_number' => ['timeLimit' => 15]
         ];
-        $laborReports = app(QueryService::class)->query($request,$laborReports,$columnQueryRules);
+        $laborReports = app(QueryService::class)->query($request->input(),$laborReports,$columnQueryRules);
         if(Gate::allows('人事管理-临时工报表-可见全部组')||Gate::allows('人事管理-门卫审核')){
             $laborReports->orWhereNull('user_workgroup_id');
         }

+ 1 - 1
app/Services/PackageService.php

@@ -17,7 +17,7 @@ Class PackageService
             'created_at_start' => ['alias' => 'created_at','startDate' => " 00:00:00"],
             'created_at_end' => ['alias' => 'created_at','endDate' => " 23:59:59"],
         ];
-        $packages = app(QueryService::class)->query($request,$packages,$columnQueryRules);
+        $packages = app(QueryService::class)->query($request->input(),$packages,$columnQueryRules);
         return $packages;
     }
 

+ 1 - 1
app/Services/ProcessService.php

@@ -43,7 +43,7 @@ Class ProcessService
             'code' => ['like' => ''],
             'owner_id' => ['multi' => ','],
         ];
-        $processes = app(QueryService::class)->query($request,$processes,$columnQueryRules);
+        $processes = app(QueryService::class)->query($request->input(),$processes,$columnQueryRules);
         return $processes;
     }
 

+ 1 - 1
app/Services/RejectedService.php

@@ -77,7 +77,7 @@ class RejectedService
                 $columnQueryRules['logistic_number_return'] = ['timeLimit' => 15];
             }
         }
-        $rejectedBills = app(QueryService::class)->query($request, $rejectedBills, $columnQueryRules);
+        $rejectedBills = app(QueryService::class)->query($request->input(), $rejectedBills, $columnQueryRules);
         return $rejectedBills;
     }
 

+ 1 - 1
app/Services/WaybillService.php

@@ -32,7 +32,7 @@ Class WaybillService
             'created_at_end' => ['alias' => 'created_at' , 'endDate' => ' 23:59:59'],
             'uriType' => ['alias' => 'type']
         ];
-        $waybills = app(QueryService::class)->query($request,$waybills,$columnQueryRules,"waybills");
+        $waybills = app(QueryService::class)->query($request->input(),$waybills,$columnQueryRules,"waybills");
         return $waybills;
     }
 

+ 14 - 79
app/Services/common/QueryService.php

@@ -12,24 +12,23 @@ Class QueryService
     /**
      * parameter - query(sql) - special column description
      *
-     * @param $queryParam ($request->all())
+     * @param array $params
      * @param object $query
      * @param array $columnQueryRules
      * @param string $tableName
      * @return object
      */
-    public function queryCondition($queryParam,$query,array $columnQueryRules,$tableName = null)
+    public function query(array $params,$query,array $columnQueryRules,$tableName = null)
     {
         if ($tableName) $tableName .= ".";
-        foreach ($queryParam as $param => $value){
+        foreach ($params as $param => $value){
             if ($param === 'paginate' || $param === 'page')continue;
-            if (!$value || isset($columnQueryRules[$param]))continue;
+            if (!$value || $columnQueryRules[$param] ?? false)continue;
             $query = $query->where($tableName.$param,$value);
         }
         //rules: alias timeLimit startDate endDate like multi
         foreach ($columnQueryRules as $param => $rules){
-            $queryCondition=$queryParam[$param]??null;
-            if (!$queryCondition)continue;
+            if (!($params[$param] ?? false) || !$params[$param])continue;
             $isExecute = true;
             $column = $param;
             foreach ($rules as $rule => $value){
@@ -40,100 +39,36 @@ Class QueryService
                 if ($rule === 'timeLimit'){
                     $today=Carbon::now()->subDays($value);
                     $queryTemp=clone $query;
-                    $queryTemp=$queryTemp->where($tableName.$column,'like','%'.$queryCondition.'%')
+                    $queryTemp=$queryTemp->where($tableName.$column,'like','%'.$params[$param].'%')
                         ->where($tableName.'created_at','>',$today);
-                    if($queryTemp->count()==0 || $queryTemp->first()[$column]==$queryCondition){
-                        $query=$query->where($tableName.$column,$queryCondition);
+                    if($queryTemp->count()==0 || $queryTemp->first()[$column]==$params[$param]){
+                        $query=$query->where($tableName.$column,$params[$param]);
                     }else{
-                        $query=$query->where($tableName.$column,'like','%'.$queryCondition.'%')
+                        $query=$query->where($tableName.$column,'like','%'.$params[$param].'%')
                             ->where($tableName.'created_at','>',$today);
                     }
                     $isExecute = true;
                 }
                 if ($rule === 'startDate'){
-                    $startDate = $queryCondition.$value;
+                    $startDate = $params[$param].$value;
                     $query = $query->where($tableName.$column,'>=',$startDate);
                     $isExecute = true;
                 }
                 if ($rule === 'endDate'){
-                    $endDate = $queryCondition.$value;
+                    $endDate = $params[$param].$value;
                     $query = $query->where($tableName.$column,'<=',$endDate);
                     $isExecute = true;
                 }
                 if ($rule === 'like'){
-                    $query = $query->where($tableName.$column,'like',$value.$queryCondition.$value);
+                    $query = $query->where($tableName.$column,'like',$value.$params[$param].$value);
                     $isExecute = true;
                 }
                 if ($rule === 'multi'){
-                    $query = $query->whereIn($tableName.$column,explode($value,$queryCondition));
+                    $query = $query->whereIn($tableName.$column,explode($value,$params[$param]));
                     $isExecute = true;
                 }
             }
-            if (!$isExecute) $query = $query->where($tableName.$column,$queryCondition);
-        }
-        return $query;
-    }
-
-/**
-     * parameter - query(sql) - special column description
-     *
-     * @param Request $request
-     * @param object $query
-     * @param array $columnQueryRules
-     * @param string $tableName
-     * @return object
-     */
-    public function query(Request $request,$query,array $columnQueryRules,$tableName = null)
-    {
-        if ($tableName) $tableName .= ".";
-        foreach ($request->input() as $param => $value){
-            if ($param === 'paginate' || $param === 'page')continue;
-            if (!$value || isset($columnQueryRules[$param]))continue;
-            $query = $query->where($tableName.$param,$value);
-        }
-        //rules: alias timeLimit startDate endDate like multi
-        foreach ($columnQueryRules as $param => $rules){
-            if (!$request->input($param))continue;
-            $isExecute = true;
-            $column = $param;
-            foreach ($rules as $rule => $value){
-                if ($rule === 'alias'){
-                    $column = $value;
-                    $isExecute = false;
-                }
-                if ($rule === 'timeLimit'){
-                    $today=Carbon::now()->subDays($value);
-                    $queryTemp=clone $query;
-                    $queryTemp=$queryTemp->where($tableName.$column,'like','%'.$request->input($param).'%')
-                        ->where($tableName.'created_at','>',$today);
-                    if($queryTemp->count()==0 || $queryTemp->first()[$column]==$request->input($param)){
-                        $query=$query->where($tableName.$column,$request->input($param));
-                    }else{
-                        $query=$query->where($tableName.$column,'like','%'.$request->input($param).'%')
-                            ->where($tableName.'created_at','>',$today);
-                    }
-                    $isExecute = true;
-                }
-                if ($rule === 'startDate'){
-                    $startDate = $request->input($param).$value;
-                    $query = $query->where($tableName.$column,'>=',$startDate);
-                    $isExecute = true;
-                }
-                if ($rule === 'endDate'){
-                    $endDate = $request->input($param).$value;
-                    $query = $query->where($tableName.$column,'<=',$endDate);
-                    $isExecute = true;
-                }
-                if ($rule === 'like'){
-                    $query = $query->where($tableName.$column,'like',$value.$request->input($param).$value);
-                    $isExecute = true;
-                }
-                if ($rule === 'multi'){
-                    $query = $query->whereIn($tableName.$column,explode($value,$request->input($param)));
-                    $isExecute = true;
-                }
-            }
-            if (!$isExecute) $query = $query->where($tableName.$column,$request->input($param));
+            if (!$isExecute) $query = $query->where($tableName.$column,$params[$param]);
         }
         return $query;
     }

+ 2 - 2
database/factories/InventoryFactory.php

@@ -2,11 +2,11 @@
 
 /** @var \Illuminate\Database\Eloquent\Factory $factory */
 
-use App\Inventory;
+use App\InventoryAccount;
 use App\Owner;
 use Faker\Generator as Faker;
 
-$factory->define(Inventory::class, function (Faker $faker) {
+$factory->define(InventoryAccount::class, function (Faker $faker) {
     $owners=Owner::select('id')->get();
     return [
         'owner_id'=>$owners[1],

+ 3 - 3
database/factories/InventoryMissionFactory.php

@@ -2,15 +2,15 @@
 
 /** @var \Illuminate\Database\Eloquent\Factory $factory */
 
-use App\InventoryMission;
+use App\InventoryAccountMission;
 use App\Commodity;
 use Faker\Generator as Faker;
 use Illuminate\Support\Str;
 
-$factory->define(InventoryMission::class, function (Faker $faker) {
+$factory->define(InventoryAccountMission::class, function (Faker $faker) {
     $commoditys=Commodity::get();
     return [
-        'inventory_id'=>'',
+        'inventory_account_id'=>'',
         'location'=>Str::random(5),
         'commodity_id'=>$commoditys[0]['id'],
         'produced_at'=>'',

+ 46 - 0
database/migrations/2020_08_25_180030_create_inventory_daily_logs_table.php

@@ -0,0 +1,46 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateInventoryDailyLogsTable extends Migration
+{
+    protected $authNames=[
+        '库存管理-库存体积',
+        '库存管理-库存体积-管理监听货主',
+    ];
+
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('inventory_daily_logs', function (Blueprint $table) {
+            $table->id();
+            $table->bigInteger('owner_id')->index()->comment('外键货主表');
+            $table->timestamp('created_at')->index()->comment('记录时间');
+            $table->bigInteger('commodity_id')->index()->comment('外键商品表');
+            $table->integer('amount')->default(0)->comment('数量');
+            $table->decimal('volumn_occupied',11,3)->nullable()->default(null)->comment('占用体积');
+        });
+        foreach ($this->authNames as $name){
+            \App\Authority::query()->create(['name'=>$name,'alias_name'=>$name]);
+        }
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('inventory_daily_logs');
+        foreach ($this->authNames as $name){
+            \App\Authority::query()->where(['name'=>$name,'alias_name'=>$name])->delete();
+        }
+    }
+}

+ 33 - 0
database/migrations/2020_08_25_180623_create_inventory_daily_logging_owners_table.php

@@ -0,0 +1,33 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateInventoryDailyLoggingOwnersTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('inventory_daily_logging_owners', function (Blueprint $table) {
+            $table->id();
+            $table->bigInteger('owner_id')->unique()->comment('外键货主表');
+            $table->enum('status',['启用','禁用'])->default('启用')->comment('货主的日常记录状态');
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('inventory_daily_logging_owners');
+    }
+}

+ 38 - 0
database/migrations/2020_08_25_180803_change_commodities_add_column_length_width_height_volumn.php

@@ -0,0 +1,38 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class ChangeCommoditiesAddColumnLengthWidthHeightVolumn extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('commodities', function (Blueprint $table) {
+            $table->decimal('length',11,3)->nullable()->comment('长度');
+            $table->decimal('width',11,3)->nullable()->comment('宽度');
+            $table->decimal('height',11,3)->nullable()->comment('高度');
+            $table->decimal('volumn',11,3)->nullable()->comment('体积');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('commodities', function (Blueprint $table) {
+            $table->dropColumn('length');
+            $table->dropColumn('width');
+            $table->dropColumn('height');
+            $table->dropColumn('volumn');
+        });
+    }
+}

+ 49 - 0
database/migrations/2020_08_26_093946_change_inventory_missions_to_inventory_account_missions.php

@@ -0,0 +1,49 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class ChangeInventoryMissionsToInventoryAccountMissions extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::dropIfExists('inventory_missions');
+        Schema::create('inventory_account_missions', function (Blueprint $table) {
+            $table->bigIncrements('id');
+            $table->integer('inventory_account_id')->index();
+            $table->string('location')->index()->comment('库位');
+            $table->integer('commodity_id')->index()->comment('商品id');
+            $table->timestamp('produced_at')->nullable()->comment('生产日期');
+            $table->timestamp('valid_at')->nullable()->comment('失效日期');
+            $table->timestamp('stored_at')->nullable()->comment('入库日期');
+            $table->string('batch_number')->nullable()->comment('批号');
+            $table->string('erp_type_position')->nullable()->comment('erp属性仓');
+            $table->string('quality')->nullable()->comment('质量状态');
+            $table->integer('stored_amount')->nullable()->comment('库存数量');
+            $table->integer('valid_amount')->default(0)->comment('可用数量');
+            $table->integer('verified_amount')->nullable()->comment('盘点数量');
+            $table->integer('re_checked_amount')->nullable()->comment('复盘数量');
+            $table->integer('difference_amount')->nullable()->comment('盘点差异');
+            $table->integer('occupied_amount')->nullable()->comment('分配数量');
+            $table->enum('checked',['是','否'])->default('否')->comment('已盘点');
+            $table->enum('returned',['是','否','无'])->default('无')->comment('已归位');
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('inventory_account_missions');
+    }
+}

+ 41 - 0
database/migrations/2020_08_26_094015_change_inventories_to_inventory_accounts.php

@@ -0,0 +1,41 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class ChangeInventoriesToInventoryAccounts extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::dropIfExists('inventories');
+        Schema::create('inventory_accounts', function (Blueprint $table) {
+            $table->bigIncrements('id');
+            $table->integer('owner_id')->index();
+            $table->enum('type',['全盘','动盘'])->comment('盘点类型');
+            $table->timestamp('start_at')->nullable();
+            $table->timestamp('end_at')->nullable();
+            $table->integer('total')->nullable()->comment('记录数');
+            $table->integer('processed')->default(0)->comment('已盘数');
+            $table->integer('difference')->default(0)->comment('复盘差异');
+            $table->integer('returned')->default(0)->comment('复盘归位');
+            $table->timestamp('deleted_at')->index()->nullable();
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('inventory_accounts');
+    }
+}

+ 3 - 3
public/js/app.js

@@ -2330,7 +2330,7 @@ function fromByteArray (uint8) {
 var BlobBuilder = typeof BlobBuilder !== 'undefined' ? BlobBuilder :
   typeof WebKitBlobBuilder !== 'undefined' ? WebKitBlobBuilder :
   typeof MSBlobBuilder !== 'undefined' ? MSBlobBuilder :
-  typeof MozBlobBuilder !== 'undefined' ? MozBlobBuilder : 
+  typeof MozBlobBuilder !== 'undefined' ? MozBlobBuilder :
   false;
 
 /**
@@ -61867,7 +61867,7 @@ var tempTip = {
     this.inputType = type;
   },
   showSuccess: function showSuccess(text) {
-    var tiper = $("<div class='row' style='color:white;opacity:0.9;position:fixed;top:40%;transform:translateY(-50%);width:100%;'>" + "<div class='col-8 offset-2'><div class='card'><div class='card-body h4 bg-success text-center'>" + text + "</div></div></div></div>");
+    var tiper = $("<div class='row' style='color:white;opacity:0.9;position:fixed;top:40%;transform:translateY(-50%);z-index:" + this.index + ";width:100%;'>" + "<div class='col-8 offset-2'><div class='card'><div class='card-body h4 bg-success text-center'>" + text + "</div></div></div></div>");
     tiper.animate({
       opacity: '0'
     }, this.fadingDuration, 'swing', function () {
@@ -61991,4 +61991,4 @@ module.exports = __webpack_require__(/*! D:\Reald\desktop\BsWAS\src\resources\sa
 
 /***/ })
 
-/******/ });
+/******/ });

+ 1 - 1
resources/js/utilities/tempTip.js

@@ -13,7 +13,7 @@ const tempTip={
         this.inputType=type;
     },
     showSuccess:function(text){
-        let tiper=$("<div class='row' style='color:white;opacity:0.9;position:fixed;top:40%;transform:translateY(-50%);width:100%;'>" +
+        let tiper=$("<div class='row' style='color:white;opacity:0.9;position:fixed;top:40%;transform:translateY(-50%);z-index:"+this.index+";width:100%;'>" +
             "<div class='col-8 offset-2'><div class='card'><div class='card-body h4 bg-success text-center'>" +
             text +
             "</div></div></div></div>");

+ 0 - 199
resources/views/inventory/statement/allInventory.blade.php

@@ -1,199 +0,0 @@
-@extends('layouts.app')
-@section('title')库存管理-全部库存@endsection
-@section('content')
-    @component('inventory.statement.menu')@endcomponent
-<div id="list" class="d-none card container-fluid" style="min-width: 1500px">
-    <div id="form_div"></div>
-    <span class="dropdown">
-        <button class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget" :class="[checkData.length>0?'btn-dark text-light':'']"
-                data-toggle="dropdown" title="导出所有页将会以搜索条件得到的筛选结果,将其全部记录(每一页)导出">
-            导出Excel
-        </button>
-        <div class="dropdown-menu">
-            <a class="dropdown-item" @click="processExport(false)" href="javascript:">导出勾选内容</a>
-            <a class="dropdown-item" @click="processExport(true)" href="javascript:">导出所有页</a>
-        </div>
-    </span>
-    <table class="table table-sm table-striped table-bordered table-hover text-nowrap card-body mt-2">
-        <tr>
-            <th>
-                <label for="all">
-                    <input id="all" type="checkbox" @click="checkAll($event)">全选
-                </label>
-            </th>
-            <th>序号</th>
-            <th>货主</th>
-            <th>库位</th>
-            <th>产品编码</th>
-            <th>产品条码</th>
-            <th>商品名称</th>
-            <th>属性仓</th>
-            <th>质量状态</th>
-            <th>失效日期</th>
-            <th>批号</th>
-            <th>在库数量</th>
-            <th>占用数量</th>
-        </tr>
-        <tr v-for="(oracleActTransactingLog,i) in oracleActTransactingLogs">
-            <td>
-                <input class="checkItem" type="checkbox" :value="oracleActTransactingLog" v-model="checkData">
-            </td>
-            <td>@{{ i+1 }}</td>
-            <td class="text-primary">@{{ oracleActTransactingLog.货主 }}</td>
-            <td class="text-muted">@{{ oracleActTransactingLog.库位 }}</td>
-            <td class="text-muted">@{{ oracleActTransactingLog.产品编码 }}</td>
-            <td class="text-muted">@{{ oracleActTransactingLog.产品条码 }}</td>
-            <td :title="oracleActTransactingLog.商品名称" class="tooltipTarget" style="max-width: 200px;overflow:hidden">@{{ oracleActTransactingLog.商品名称 }}</td>
-            <td class="text-muted">@{{ oracleActTransactingLog.属性仓 }}</td>
-            <td class="text-muted">@{{ oracleActTransactingLog.质量状态 }}</td>
-            <td class="text-muted">@{{ oracleActTransactingLog.失效日期 }}</td>
-            <td class="text-muted">@{{ oracleActTransactingLog.批号 }}</td>
-            <td><span v-if="oracleActTransactingLog.在库数量">@{{ oracleActTransactingLog.在库数量 }}</span><span v-else>0</span></td>
-            <td><span v-if="oracleActTransactingLog.占用数量">@{{ oracleActTransactingLog.占用数量 }}</span><span v-else>0</span></td>
-        </tr>
-    </table>
-    <div>
-        <button type="button" @click="pageUp()" :readonly="page>1?false:true" class="btn btn-sm " :class="page>1?'btn-outline-info':''">上一页</button>
-        <button type="button" @click="pageDown()" :readonly="page<maxPage?false:true" class="btn btn-sm m-3" :class="page<maxPage?'btn-outline-info':''">下一页</button>
-        <div v-if="isPage">
-            <input  @keyup.enter="pageSkip($event)" class="form-control-sm ml-3 tooltipTarget" :placeholder="'当前页数:'+page+'/'+maxPage" title="去往指定页">
-            <span class="text-muted m-1">共 @{{ sum }} 条</span>
-        </div>
-    </div>
-</div>
-@endsection
-
-@section('lastScript')
-    <script type="text/javascript" src="{{asset('js/queryForm/export200818a.js')}}"></script>
-    <script type="text/javascript" src="{{asset('js/queryForm/queryForm200805b.js')}}"></script>
-    <script>
-        $.cookie('xxx', 2223);
-        new Vue({
-            el:"#list",
-            data:{
-                oracleActTransactingLogs:{!! $oracleActTransactingLogs !!},
-                page:Number('{{$page}}'),
-                owners:[
-                    @foreach($owners as $owner)
-                    {name:'{{$owner->descr_c}}',value:'{{$owner->descr_c}}'},
-                    @endforeach
-                ],
-                checkData:[],
-                maxPage:1,
-                sum:0,
-                isPage:true,
-                date:[{name:'1',value:'近一天'},{name:'3',value:'近三天'},{name:'7',value:'近一周'},{name:'30',value:'近一月'},],
-            },
-            mounted:function () {
-                $(".tooltipTarget").tooltip({'trigger':'hover'});
-                $("#list").removeClass('d-none');
-                if (this.oracleActTransactingLogs.length>0){
-                    this.maxPage=Math.ceil(this.oracleActTransactingLogs[0].sum/50);
-                    this.sum=this.oracleActTransactingLogs[0].sum;
-                }
-                let data=[
-                    [
-                        {name:['date_start','range'],type:'dateTime_select',tip:['选择创建日期的起始时间','查询内容的日期范围'],placeholder:['','查询内容的日期范围'],data: this.date
-                            ,killings:[['range'],['date_start']]},
-                        {name:'TOLocation',type:'input',tip:'库位:糊模查找需要在左边打上%符号',placeholder: '库位'},
-                        {name:'LotAtt05',type:'input',tip:'属性仓:糊模查找需要在左边打上%符号',placeholder: '属性仓'},
-                        {name:'LotAtt02_start',type:'dateTime',tip:'选择显示失效日期的起始时间'},
-                        {name:'descr_c',type:'select_multiple_select',tip:['输入关键词快速定位下拉列表,回车确定','选择要显示的客户'],
-                            placeholder:['货主','定位或多选货主'],data:this.owners},
-                    ],
-                    [
-                        {name:'date_end',type:'dateTime',tip:'选择创建日期的结束时间',killings:['range']},
-                        {name:'SKU',type:'input',tip:'产品编码:糊模查找需要在左边打上%符号',placeholder: '产品编码'},
-                        {name:'ALTERNATE_SKU1',type:'input',tip:'产品条码:糊模查找需要在左边打上%符号',placeholder: '产品条码'},
-                        {name:'LotAtt02_end',type:'dateTime',tip:'选择显示失效日期的结束时间'},
-                    ],
-                ];
-                this.form = new query({
-                    el:'#form_div',
-                    condition:data
-                });
-                this.form.init();
-                let thisUrl=document.URL;
-                let parameter=thisUrl.split('?',2);
-                if (parameter.length > 1){
-                    let _this=this;
-                    let list=['ALTERNATE_SKU1','LotAtt05','LotAtt02_start','descr_c','LotAtt02_end'];
-                    let param=parameter[1].split('&');
-                    param.every(function (data) {
-                        let arr=data.split('=');
-                        if (arr.length > 1){
-                            if (list.includes(arr[0]) && arr[1]){
-                                _this.isPage = false;
-                                return false;
-                            }
-                        }
-                        return true;
-                    });
-                }
-            },
-            watch:{
-                checkData:{
-                    handler(){
-                        if (this.checkData.length === this.oracleActTransactingLogs.length){
-                            document.querySelector('#all').checked = true;
-                        }else {
-                            document.querySelector('#all').checked = false;
-                        }
-                    },
-                    deep:true
-                }
-            },
-            methods:{
-                pageUp(){
-                    if (this.page<=1)return;
-                    this.href(this.page-1);
-                },
-                pageDown(){
-                    if (this.page>=this.maxPage)return;
-                    this.href(this.page+1);
-                },
-                pageSkip(e){
-                    if (Number(e.target.value)<=0 || Number(e.target.value)>this.maxPage){
-                        tempTip.setDuration(2000);
-                        tempTip.show('页数不存在! ');
-                        return
-                    }
-                    this.href(e.target.value);
-                },
-                href(page){
-                    let url = document.URL;
-                    if (url.indexOf('page='+this.page) != -1){
-                        url = url.replace("page="+this.page,"page="+page);
-                    }else{
-                        if (url.indexOf('?') == -1) url += "?page="+page;
-                        else url += "&page="+page;
-                    }
-                    window.location.href=url;
-                },
-                //全选事件
-                checkAll(e){
-                    if (e.target.checked){
-                        this.oracleActTransactingLogs.forEach((el,i)=>{
-                            if (this.checkData.indexOf(el) == '-1'){
-                                this.checkData.push(el);
-                            }
-                        });
-                    }else {
-                        this.checkData = [];
-                    }
-                },
-                processExport(checkAllSign){
-                    let url = '{{url('inventory/statement/changeInventory/export')}}';
-                    let token='{{ csrf_token() }}';
-                    let data= JSON.stringify( this.checkData );
-                    excelExport(checkAllSign,data,url,this.sum,token);
-                },
-            },
-            filters:{
-                json(value) {
-                    return JSON.stringify(value);
-                }
-            },
-        });
-    </script>
-@endsection

+ 4 - 0
resources/views/inventory/statement/changeInventory.blade.php

@@ -34,8 +34,10 @@
             <td class="text-muted">@{{ oracleActTransactingLog.质量状态 }}</td>
             <td class="text-muted">@{{ oracleActTransactingLog.失效日期 }}</td>
             <td class="text-muted">@{{ oracleActTransactingLog.批号 }}</td>
+            @if(!$isTotalStock)
             <td>@{{ oracleActTransactingLog.移出数量 }}</td>
             <td>@{{ oracleActTransactingLog.移入数量 }}</td>
+            @endif
             <td><span v-if="oracleActTransactingLog.在库数量">@{{ oracleActTransactingLog.在库数量 }}</span><span v-else>0</span></td>
             <td><span v-if="oracleActTransactingLog.占用数量">@{{ oracleActTransactingLog.占用数量 }}</span><span v-else>0</span></td>
         </tr>
@@ -132,8 +134,10 @@
                     {name:'质量状态',value: '质量状态', class:'text-muted'},
                     {name:'失效日期',value: '失效日期', class:'text-muted'},
                     {name:'批号',value: '批号', class:'text-muted'},
+                    @if(!$isTotalStock)
                     {name:'移出数量',value: '移出数量', neglect: true},
                     {name:'移入数量',value: '移入数量', neglect: true},
+                    @endif
                     {name:'在库数量',value: '在库数量', neglect: true},
                     {name:'占用数量',value: '占用数量', neglect: true},
                 ];

+ 248 - 0
resources/views/inventory/statement/dailyLog.blade.php

@@ -0,0 +1,248 @@
+@extends('layouts.app')
+@section('title')库存管理-库存体积@endsection
+
+@section('content')
+    @component('inventory.statement.menu')@endcomponent
+    <div class="d-none card" id="container">
+        <div class="modal fade" id="modal" tabindex="-1" role="dialog" aria-labelledby="pasteDataTitle" aria-hidden="true">
+            <div class="modal-dialog modal-dialog-centered modal-lg" role="document">
+                <div class="modal-content">
+                    <div class="modal-header row form-inline">
+                        <input type="text" v-model="name" class="form-control form-control-sm col-5 offset-3" placeholder="搜索货主,点击下方块添加" />
+                        <button class="btn btn-sm btn-info col-2" @click="seekOwner()">搜索</button>
+                        <label class="col-2"></label>
+                    </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"
+                                :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>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="card-header pt-0">
+            <div id="form"></div>
+        </div>
+        <div class="w-100 ml-4 mt-0 mb-0">
+            <span class="dropdown d-none">
+                <button class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget" :class="[checkData.length>0?'btn-dark text-light':'']"
+                        data-toggle="dropdown" title="导出所有页将会以搜索条件得到的过滤结果,将其全部记录(每一页)导出">
+                    导出Excel
+                </button>
+                <div class="dropdown-menu">
+                    <a class="dropdown-item" @click="dailyLogExport(false)" href="javascript:">导出勾选内容</a>
+                    <a class="dropdown-item" @click="dailyLogExport(true)" href="javascript:">导出所有页</a>
+                </div>
+            </span>
+            @can('库存管理-库存体积-管理监听货主')<button class="btn btn-outline-info btn-sm tooltipTarget" @click="openModal()">添加监听货主</button>@endcan
+        </div>
+        <div class="card-body pt-1">
+            <label for="all" class="d-none" id="cloneCheckAll">
+                <input id="all" type="checkbox" @click="checkAll($event)">全选
+            </label>
+            <table class="table table-sm text-nowrap table-bordered d-none" id="headerRoll"></table>
+            <table class="table table-sm text-nowrap table-striped table-bordered m-0" id="headerParent">
+                <tr class="p-0" id="header"></tr>
+                <tr v-for="(inventoryDailyLog,i) in inventoryDailyLogs">
+                   <td>
+                       <input type="checkbox" :value="inventoryDailyLog.id" v-model="checkData">
+                   </td>
+                    <td>@{{ i+1 }}</td>
+                    <td>@{{ inventoryDailyLog.owner_name }}</td>
+                    <td>@{{ inventoryDailyLog.created_at }}</td>
+                    <td>@{{ inventoryDailyLog.commodity_name }}</td>
+                    <td>@{{ inventoryDailyLog.commodity_sku }}</td>
+                    <td>
+                        <span v-if="inventoryDailyLog.commodity_barcodes && inventoryDailyLog.commodity_barcodes.length>0">
+                            <span v-if="inventoryDailyLog.commodity_barcodes.length==1">
+                                @{{ inventoryDailyLog.commodity_barcodes[0].code }}
+                            </span>
+                            <span v-if="inventoryDailyLog.commodity_barcodes.length>1">
+                                <small v-for="barcode in inventoryDailyLog.commodity_barcodes">@{{ barcode.code }}<br></small>
+                            </span>
+                        </span>
+                    </td>
+                    <td>@{{ inventoryDailyLog.amount }}</td>
+                    <td>@{{ inventoryDailyLog.commodity_length }}</td>
+                    <td>@{{ inventoryDailyLog.commodity_width }}</td>
+                    <td>@{{ inventoryDailyLog.commodity_height }}</td>
+                    <td>@{{ inventoryDailyLog.commodity_volumn }}</td>
+                    <td>@{{ inventoryDailyLog.volumn_occupied }}</td>
+                </tr>
+            </table>
+            {{$inventoryDailyLogs->appends($param)->links()}}
+        </div>
+    </div>
+@endsection
+
+@section('lastScript')
+    <script type="text/javascript" src="{{asset('js/queryForm/export200818a.js')}}"></script>
+    <script type="text/javascript" src="{{asset('js/queryForm/queryForm200818a.js')}}"></script>
+    <script type="text/javascript" src="{{asset('js/queryForm/header200819.js')}}"></script>
+    <script>
+        let vue = new Vue({
+            el:"#container",
+            data:{
+                inventoryDailyLogs : [
+                    @foreach($inventoryDailyLogs as $inventoryDailyLog)
+                    {id:'{{$inventoryDailyLog->id}}',owner_name:'{{$inventoryDailyLog->owner ? $inventoryDailyLog->owner->name : ''}}',
+                        created_at:'{{$inventoryDailyLog->created_at}}', commodity_name:'{{$inventoryDailyLog->commodity ? $inventoryDailyLog->commodity->name : ''}}',
+                        commodity_sku:'{{$inventoryDailyLog->commodity ? $inventoryDailyLog->commodity->sku : ''}}',
+                        commodity_barcodes:[
+                            @foreach($inventoryDailyLog->commodity ? $inventoryDailyLog->commodity->barcodes ?? [] : [] as $barcode)
+                            {code:'{{$barcode->code}}'},
+                            @endforeach
+                        ],
+                        amount:'{{$inventoryDailyLog->amount}}', commodity_length:'{{$inventoryDailyLog->commodity ? $inventoryDailyLog->commodity->length : ''}}',
+                        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}}'},
+                    @endforeach
+                ],
+                owners : [
+                    @foreach($owners as $owner)
+                    {name:"{{$owner->id}}",value:"{{$owner->name}}"},
+                    @endforeach
+                ],
+                checkData:[],
+                name : "",
+                loggingOwners : [],
+                seekOwners : [],
+            },
+            watch:{
+                checkData:{
+                    handler(){
+                        if (this.checkData.length === this.inventoryDailyLogs.length){
+                            document.querySelector('#all').checked = true;
+                            document.querySelector('#all_temp').checked = true;
+                        }else {
+                            document.querySelector('#all').checked = false;
+                            document.querySelector('#all_temp').checked = false;
+                        }
+                    },
+                    deep:true
+                }
+            },
+            mounted(){
+                $(".tooltipTarget").tooltip({'trigger': 'hover'});
+                $("#container").removeClass('d-none');
+                let data=[
+                    [
+                        {name:'created_at_start',type:'dateTime',tip:'选择创建日期的起始时间'},
+                        {
+                            name: 'owner_id', type: 'select_multiple_select', tip: ['输入关键词快速定位下拉列表,回车确定', '选择要显示的客户'],
+                            placeholder: ['货主', '定位或多选货主'], data: this.owners
+                        },
+                    ],
+                    [
+                        {name:'created_at_end',type:'dateTime',tip:'选择创建日期的结束时间'},
+                    ],
+                ];
+                this.form = new query({
+                    el:'#form',
+                    condition:data
+                });
+                this.form.init();
+                let column = [
+                    {name:'cloneCheckAll',customization:true,type:'checkAll',column:'id',
+                        dom:$('#cloneCheckAll').removeClass('d-none'), neglect: true},
+                    {name:'index',value: '序号', neglect: true},
+                    {name:'owner_name',value: '货主'},
+                    {name: 'created_at', value: '日期'},
+                    {name: 'commodity_name', value: '商品名称'},
+                    {name:'commodity_sku',value: '商品编码'},
+                    {name: 'commodity_barcodes', value: '商品条码', neglect: true},
+                    {name: 'amount', value: '在库数量', neglect: true},
+                    {name: 'commodity_length', value: '长', neglect: true},
+                    {name: 'commodity_width',value: '宽', neglect: true},
+                    {name: 'commodity_height', value: '高', neglect: true},
+                    {name: 'commodity_volumn', value: '体积', neglect: true},
+                    {name: 'volumn_occupied', value: '总占用体积', neglect: true},
+                ];
+                let _this = this;
+                setTimeout(function () {
+                    let header = new Header({
+                        el: "#header",
+                        column: column,
+                        data: _this.inventoryDailyLogs,
+                        restorationColumn: 'id',
+                        fixedTop:($('#form').height())+2,
+                        vue:vue
+                    });
+                    header.init();
+                },0);
+            },
+            methods:{
+                //全选事件
+                checkAll(e) {
+                    if (e.target.checked) {
+                        this.inventoryDailyLogs.forEach((el) => {
+                            if (!el.id) this.checkData.push(el.id);
+                            if (el.id && this.checkData.indexOf(el.id) === -1) {
+                                this.checkData.push(el.id);
+                            }
+                        });
+                    } else {
+                        this.checkData = [];
+                    }
+                },
+                dailyLogExport(type){
+
+                },
+                openModal(){
+                    let url = "{{url('inventory/statement/dailyLog/getLoggingOwner')}}";
+                    axios.post(url).then(res=>{
+                       this.loggingOwners = res.data;
+                        $("#modal").modal('show');
+                    });
+                },
+                seekOwner(){
+                    if (!this.name)return ;
+                    let name = this.name;
+                    let seekOwners = [];
+                    this.owners.forEach(function (owner) {
+                        if ((owner.value).indexOf(name) !== -1){
+                            seekOwners.push(owner.name);
+                        }
+                    });
+                    if (seekOwners.length > 0)this.seekOwners = seekOwners;
+                },
+                addLoggingOwner(owner_id,name){
+                    if (!owner_id){
+                        alert('选中记录异常!');
+                        return;
+                    }
+                    if (this.loggingOwners.includes(Number(owner_id))){
+                        return;
+                    }
+                    if (!confirm("确定要添加对“"+name+"”的监听吗?"))return;
+                    let url = "{{url('inventory/statement/dailyLog/addLoggingOwner')}}";
+                    axios.post(url,{
+                        owner_id:owner_id
+                    }).then(res=>{
+                        tempTip.setDuration(2000);
+                        tempTip.setIndex(1099);
+                        if (res.data.success){
+                            this.loggingOwners.push(Number(res.data.data));
+                            this.seekOwners = [];
+                            tempTip.showSuccess('成功添加对“'+name+"的记录监听");
+                            tempTip.setIndex(99);
+                            return;
+                        }
+                        tempTip.show(res.data.data);
+                        tempTip.setIndex(99);
+                    }).catch(err=>{
+                        tempTip.setDuration(3000);
+                        tempTip.setIndex(1099);
+                        tempTip.show('网络连接错误:'+err);
+                        tempTip.setIndex(99);
+                    });
+                }
+            },
+        });
+    </script>
+@endsection

+ 4 - 0
resources/views/inventory/statement/menu.blade.php

@@ -12,6 +12,10 @@
                     <li class="nav-item">
                         <a class="nav-link" href="{{url('inventory/statement/allInventory')}}" :class="{active:isActive('allInventory',3)}">全部库存</a>
                     </li> @endcan
+                @can('库存管理-库存体积')
+                    <li class="nav-item">
+                        <a class="nav-link" href="{{url('inventory/statement/dailyLog')}}" :class="{active:isActive('dailyLog',3)}">库存体积</a>
+                    </li> @endcan
             </ul>
         </div>
     </div>

+ 62 - 37
resources/views/inventory/stockInventory/inventoryMission.blade.php

@@ -1,78 +1,82 @@
 @extends('layouts.app')
-@section('title')盘点-任务-{!! $inventory->id !!}@endsection
+@section('title')盘点-任务-{!! $inventoryAccount->id !!}@endsection
 
 @section('content')
         @component('inventory.stockInventory.menu')
             <li class="nav-item">
-                <a  class="nav-link" href="{{URL::current()}}" :class="{active:isActive('enterStockInventory',3)}">盘点中({!! $inventory->id !!})</a>
+                <a  class="nav-link" href="{{URL::current()}}" :class="{active:isActive('enterStockInventory',3)}">盘点中({!! $inventoryAccount->id !!})</a>
             </li>
         @endcomponent
-    <div id="list" class="container-fluid" style="min-width: 1500px">
-        <div class="mt-3 pl-5">
-        <span class="form-group pl-5 shadow-sm p-2 mb-5 bg-white rounded">
-            <label class="col-1 font-weight-bold">货主:</label><span>@{{ inventory.owner.name }}</span>
+    <div id="list" class="d-none container-fluid" >
+        <div class="mt-3 offset-1">
+        <span class="form-group  shadow-sm p-2 mb-5 bg-white rounded">
+            <label class=" font-weight-bold">货主:</label><span>@{{ inventory.owner.name }}</span>
         </span>
-            <span class="form-group pl-5 shadow-sm p-2 mb-5 bg-white rounded">
-            <label class="col-1 font-weight-bold">盘点单号:</label><span>@{{ inventory.id }}</span>
+        <span class="form-group  shadow-sm p-2 mb-5 bg-white rounded">
+            <label class=" font-weight-bold">盘点单号:</label><span>@{{ inventory.id }}</span>
         </span>
         </div>
-        <div class="mt-3 pl-5">
-        <span class="form-group pl-5 shadow-sm p-2 mb-5 bg-white rounded">
-            <label class="col-1 font-weight-bold">时间范围:</label><span>@{{ inventory.start_at }}——@{{ inventory.end_at }}</span>
+
+        <div class="mt-3 offset-1">
+        <span class="form-group  shadow-sm p-2 mb-5 bg-white rounded">
+            <label class=" font-weight-bold">时间范围:</label><span>@{{ inventory.start_at }}—@{{ inventory.end_at }}</span>
         </span>
-        <span class="form-group pl-5 shadow-sm p-2 mb-5 bg-white rounded" v-if="inventory.surplus!=0">
-            <label class="col-1 font-weight-bold">已盘点:</label><span>@{{ inventory.processed }}/总数:@{{ inventory.total }}</span>
+
+        <span class="form-group  shadow-sm p-2 mb-5 bg-white rounded" v-if="inventory.surplus!=0">
+            <label class=" font-weight-bold">已盘点:</label><span>@{{ inventory.processed }}/总数:@{{ inventory.total }}</span>
         </span>
-        <span class="form-group pl-5 shadow-sm p-2 mb-5 bg-white rounded" v-if="inventory.surplus!=0">
-            <label class="col-1 font-weight-bold">剩余数:</label><span>@{{ inventory.surplus }}</span>
+        <span class="form-group  shadow-sm p-2 mb-5 bg-white rounded" v-if="inventory.surplus!=0">
+            <label class=" font-weight-bold">剩余数:</label><span>@{{ inventory.surplus }}</span>
         </span>
-            <span class="form-group pl-5 shadow-sm p-2 mb-5 bg-white rounded" v-if="inventory.surplus==0">
-            <label class="col-1 font-weight-bold">盘点记录数:</label><span>@{{ inventory.total }}</span>
+        <span class="form-group  shadow-sm p-2 mb-5 bg-white rounded" v-if="inventory.surplus==0">
+            <label class=" font-weight-bold">盘点记录数:</label><span>@{{ inventory.total }}</span>
         </span>
-            <span class="form-group pl-5 shadow-sm p-2 mb-5 bg-white rounded" v-if="inventory.surplus==0">
-            <label class="col-1 font-weight-bold">复盘剩余数:</label><span>@{{ inventory.check_surplus }}/复盘总数:@{{ inventory.total }}</span>
+        <span class="form-group  shadow-sm p-2 mb-5 bg-white rounded" v-if="inventory.surplus==0">
+            <label class=" font-weight-bold">复盘剩余数:</label><span>@{{ inventory.check_surplus }}/复盘总数:@{{ inventory.total }}</span>
         </span>
         </div>
-        <div class="mt-4 ml-5" >
-        <span class="btn col-1 font-weight-bold"  style="cursor: default" :class="inventory.surplus!=0?'bg-info':'btn-outline-info disabled'">
+
+
+        <div class="row offset-1 mt-3" >
+        <span class="btn  col-md-2 font-weight-bold"  style="cursor: default;max-width: 160px" :class="inventory.surplus!=0?'bg-info':'btn-outline-info disabled'">
             @{{ inventory.type }}
         </span>
-            <span class="btn col-1 font-weight-bold" style="cursor: default" :class="inventory.surplus!=0?'btn-outline-info disabled':'bg-info'">复盘</span>
+            <span class="btn  col-md-2 font-weight-bold" style="cursor: default;max-width: 160px" :class="inventory.surplus!=0?'btn-outline-info disabled':'bg-info'">复盘</span>
         </div>
 
-        <form id="form"  class="mt-3 pl-5">
-            <div class="row" :class="inventory.surplus!=0?'row-cols-3':'row-cols-5'">
+        <form id="form"  class="row mt-3 offset-1">
+            <div class="row form-inline" :class="inventory.surplus!=0?'row-cols-3':'row-cols-5'">
         <span>
-            <label for="location" class="text-secondary font-weight-bold">请输库位</label>
-            <input id="inventoryInput" name="location" type="text" class="form-control col-6 input"  autocomplete="off" value="@if(old('location')){{old('location')}}@endif">
+            <label for="location" class="text-secondary font-weight-bold">请输库位</label>
+            <input id="inventoryInput" name="location" type="text" class="form-control  input"  autocomplete="off" value="@if(old('location')){{old('location')}}@endif">
         </span>
         <span>
-            <label for="barcode" class="text-secondary font-weight-bold">请输产品条码</label>
-            <input id="barcode" name="barcode" type="text" value="@if(old('barcode')){{old('barcode')}}@endif" class="form-control col-6 input" autocomplete="off" @blur="searchBarcode">
+            <label for="barcode" class="text-secondary font-weight-bold">请输产品条码</label>
+            <input id="barcode" name="barcode" type="text" value="@if(old('barcode')){{old('barcode')}}@endif" class="form-control  input" autocomplete="off" @blur="searchBarcode">
         </span>
         <span>
-            <label for="count" class="text-secondary font-weight-bold">请输盘点数</label>
-            <input type="text" id="count" name="count" class="form-control col-6 input" value="@if(old('count')){{old('count')}}@endif"  autocomplete="off">
+            <label for="count" class="text-secondary font-weight-bold">请输盘点数</label>
+            <input type="text" id="count" name="count" class="form-control input" value="@if(old('count')){{old('count')}}@endif"  autocomplete="off">
         </span>
 
         <span v-if="inventory.surplus==0">
             <label for="count" class="text-secondary font-weight-bold">上一次盘点数</label>
             <span v-if="!inventoryMissionRecord.re_checked_amount">
-                <input type="text" id="count" name="count" v-model="inventoryMissionRecord.verified_amount" class="form-control col-6 input" readonly>
+                <input type="text" id="count" name="count" v-model="inventoryMissionRecord.verified_amount" class="form-control  input" readonly>
             </span>
             <span v-if="inventoryMissionRecord.re_checked_amount">
-                <input type="text" id="count" name="count" v-model="inventoryMissionRecord.re_checked_amount" class="form-control col-6 input" readonly>
+                <input type="text" id="count" name="count" v-model="inventoryMissionRecord.re_checked_amount" class="form-control  input" readonly>
             </span>
         </span>
         <span v-if="inventory.surplus==0">
             <label for="count" class="text-secondary font-weight-bold">盘点差异数</label>
-            <input type="text" id="count" name="count" v-model="inventoryMissionRecord.difference_amount" class="form-control col-6 input" readonly>
+            <input type="text" id="count" name="count" v-model="inventoryMissionRecord.difference_amount" class="form-control  input" readonly>
         </span>
             </div>
         </form>
 
 
-        <table class="table table-sm table-striped table-bordered table-hover text-nowrap card-body mt-2">
+        <table class="table table-sm table-striped table-bordered table-hover text-nowrap d-none d-sm-block  mt-2">
             <tr>
                 <th>序号</th>
                 <th>库位</th>
@@ -91,7 +95,7 @@
                 <th>盘点差异</th>
                 <th>分配数量</th>
             </tr>
-            <tr v-for="(inventoryMission,i) in inventoryMissions" v-if="inventoryMission.checked=='是'" @click="selectedColor(inventoryMission.id)" :style="{'font-weight': inventory.id==selectedStyle?'bold':''}">
+            <tr v-for="(inventoryMission,i) in inventoryMissions" v-if="inventoryMission.checked=='是'"  @click="selectedColor(inventoryMission.id)" :style="{'font-weight': inventory.id==selectedStyle?'bold':''}">
                 <td>@{{ i+1 }}</td>
                 <td>@{{ inventoryMission.location }}</td>
                 <td v-if="inventoryMission.commodity">@{{ inventoryMission.commodity.name }}</td>
@@ -110,6 +114,27 @@
                 <td>@{{ inventoryMission.occupied_amount }}</td>
             </tr>
         </table>
+
+        <table class="table table-striped table-sm table-bordered table-hover p-0 d-block d-sm-none" style="background: rgb(255, 255, 255);" >
+            <tbody>
+            <tr v-for="inventoryMission in inventoryMissions" v-if="inventoryMission.checked=='是'">
+                <td style="filter:grayscale(30%); ">
+                    <div  class="mt-3">
+                        <div style="transform:scale(0.9)" class="pl-0">
+                            <span class="mr-3 text-nowrap"><span class="font-weight-bold">库位:</span><span style="color:#af7651">@{{ inventoryMission.location }}</span></span>
+                            <span class="mr-3 text-nowrap"><span class="font-weight-bold">产品名称:</span><span style="color:#af7651" v-if="inventoryMission.commodity">@{{ inventoryMission.commodity.name }}</span></span>
+                            <span class="mr-3 text-nowrap"><span class="font-weight-bold">产品条码:</span><span style="color:#af7651" v-if="inventoryMission.commodity">@{{ inventoryMission.commodity.barcode }}</span></span>
+                            <div v-if="inventory.surplus==0">
+                            <span class="mr-3 text-nowrap"><span style="color:#783000" class="font-weight-bold">盘点数量:</span><span style="color:#af7651">@{{ inventoryMission.verified_amount }}</span></span>
+                            <span class="mr-3 text-nowrap"><span style="color:#783000" class="font-weight-bold">复盘数量:</span><span style="color:#af7651">@{{ inventoryMission.re_checked_amount }}</span></span>
+                            <span class="mr-3 text-nowrap"><span style="color:#783000" class="font-weight-bold">盘点差异:</span><span >@{{ inventoryMission.difference_amount }}</span></span>
+                            </div>
+                        </div>
+                    </div>
+                </td>
+            </tr>
+            </tbody>
+        </table>
     </div>
 
 
@@ -120,8 +145,8 @@
         let listVue = new Vue({
             el: "#list",
             data: {
-                inventory:{!! $inventory!!},
-                inventoryMissions:{!! $inventoryMissions !!},
+                inventory:{!! $inventoryAccount!!},
+                inventoryMissions:{!! $inventoryAccountMissions !!},
                 checkData: [],
                 selectedStyle:'',
                 inventoryMissionRecord:{},

+ 101 - 54
resources/views/inventory/stockInventory/mission.blade.php

@@ -5,22 +5,27 @@
 @section('content')
     @component('inventory.stockInventory.menu')@endcomponent
     <div id="list" class="container-fluid" style="min-width: 1500px">
-        <div id="form_div"></div>
-        <span class="dropdown">
-        <button class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget" :class="[checkData.length>0?'btn-dark text-light':'']"
-                data-toggle="dropdown" title="导出所有页将会以搜索条件得到的筛选结果,将其全部记录(每一页)导出">
-            导出Excel
-        </button>
-        <div class="dropdown-menu">
-            <a class="dropdown-item" @click="inventoryExport(false)" href="javascript:">导出勾选内容</a>
-            <a class="dropdown-item" @click="inventoryExport(true)" href="javascript:">导出所有页</a>
-        </div>
-    </span>
-        @can('库存管理-盘点')
-            <span v-if="formData.date_start&&formData.date_end" 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
-        <table class="table table-sm table-striped table-bordered table-hover text-nowrap card-body mt-2">
+        {{--        <div id="form_div"></div>--}}
+        <form class="form-inline mt-3">
+            <span class="form-inline ml-5">
+                <select class="form-control form-control-sm tooltipTarget" name="owner_id" id="owner_id" style="width: 150px" title="选择指定货主">
+                    <option value="">货主</option>
+                    <option v-for="owner in owners" :value="owner.name">@{{ owner.value }}</option>
+                </select>
+            </span>
+            <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">
+            </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-else class="btn btn-sm btn-outline-secondary  tooltipTarget" @click="createInventoryMission" title="选择单一指定货主生成盘点任务">生成全盘任务</span>
+                @endcan
+            </span>
+        </form>
+
+        <table class="table table-sm table-striped table-bordered table-hover text-nowrap card-body mt-3">
             <tr>
                 <th>
                     <label for="all">
@@ -42,7 +47,7 @@
                 <th>复盘归位</th>
                 <th>操作</th>
             </tr>
-            <tr v-for="(inventory,i) in inventories" @click="selectedColor(inventory.id)" :style="{'font-weight': inventory.id==selectedStyle?'bold':''}">
+            <tr v-for="(inventory,i) in inventoryAccounts" @click="selectedColor(inventory.id)" :style="{'font-weight': inventory.id==selectedStyle?'bold':''}">
                 <td>
                     <input class="checkItem" type="checkbox" :value="inventory.id" v-model="checkData">
                 </td>
@@ -66,20 +71,30 @@
                 </td>
             </tr>
         </table>
-        <div class="text-info h5 btn btn">{{$inventories->count()}}/@{{ sum }}</div>
-        <div>{{$inventories->appends($paginateParams)->links()}}</div>
+        <div class="text-info h5 btn btn">{{$inventoryAccounts->count()}}/@{{ sum }}</div>
+        <div>{{$inventoryAccounts->appends($paginateParams)->links()}}</div>
+        <span class="dropdown">
+        <button class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget" :class="[checkData.length>0?'btn-dark text-light':'']"
+                data-toggle="dropdown" title="导出所有页将会以搜索条件得到的筛选结果,将其全部记录(每一页)导出">
+            导出Excel
+        </button>
+        <div class="dropdown-menu">
+            <a class="dropdown-item" @click="inventoryExport(false)" href="javascript:">导出勾选内容</a>
+            <a class="dropdown-item" @click="inventoryExport(true)" href="javascript:">导出所有页</a>
+        </div>
+        </span>
     </div>
 
 @endsection
 
 @section('lastScript')
     <script type="text/javascript" src="{{asset('js/queryForm/export200818a.js')}}"></script>
-    <script type="text/javascript" src="{{asset('js/queryForm/queryForm200805b.js')}}"></script>
+    <script type="text/javascript" src="{{asset('js/queryForm/queryForm200818a.js')}}"></script>
     <script>
         new Vue({
             el: "#list",
             data: {
-                inventories:{!! $inventories->toJson()!!}['data'],
+                inventoryAccounts:{!! $inventoryAccounts->toJson()!!}['data'],
                 owners: [
                         @foreach($owners as $owner)
                     {
@@ -89,27 +104,29 @@
                 ],
                 checkData: [],
                 selectedStyle:'',
-                sum:{!! $inventories->total() !!},
-                formData:{},
+                sum:{!! $inventoryAccounts->total() !!},
+                // formData:{},
+                date_end:'',
+                date_start:'',
             },
             mounted: function () {
                 $(".tooltipTarget").tooltip({'trigger': 'hover'});
                 $("#list").removeClass('d-none');
-                let data=[
-                    [
-                        {name:'owner_id',type:'select_multiple_select',tip:['输入关键词快速定位下拉列表,回车确定','选择要显示的客户'],
-                            placeholder:['货主','定位或多选货主'],data:this.owners},
-                        {name:'date_start',type:'dateTime',tip:'选择创建日期的开始时间',},
-                        {name:'date_end',type:'dateTime',tip:'选择创建日期的结束时间',},
-                    ],
-                ];
-                this.form = new query({
-                    el:'#form_div',
-                    condition:data,
-                });
-                this.form.init();
-                let obj=this.form.getSearchData();
-                this.formData=obj;
+                // let data=[
+                //     [
+                //         {name:'owner_id',type:'select_multiple_select',tip:['输入关键词快速定位下拉列表,回车确定','选择要显示的客户'],
+                //             placeholder:['货主','定位或多选货主'],data:this.owners},
+                //         {name:'date_start',type:'dateTime',tip:'选择创建日期的开始时间',},
+                //         {name:'date_end',type:'dateTime',tip:'选择创建日期的结束时间',},
+                //     ],
+                // ];
+                // this.form = new query({
+                //     el:'#form_div',
+                //     condition:data,
+                // });
+                // this.form.init();
+                // let obj=this.form.getSearchData();
+                // this.formData=obj;
             },
             methods:{
                 selectedColor(id){
@@ -138,32 +155,56 @@
                 //生成盘点任务
                 createInventoryMission(){
                     let _this=this;
-                    if (_this.formData.owner_id.length<=0){
-                        tempTip.setDuration(1000);
+                    const date_end=document.getElementById('date_end').value;
+                    const date_start=document.getElementById('date_start').value;
+                    const owner_id=document.getElementById('owner_id').value;
+                    if(document.getElementById('owner_id').value==''){
+                        tempTip.setDuration(2000);
                         tempTip.show('生成盘点任务失败'+'   '+'请先选择货主!');
                         return;
                     }
+                    if(!date_end && date_start){
+                        tempTip.setDuration(2000);
+                        tempTip.show('生成盘点任务失败'+'   '+'请选择结束时间!');
+                        return;
+                    }
+                    if(date_end && !date_start){
+                        tempTip.setDuration(2000);
+                        tempTip.show('生成盘点任务失败'+'   '+'请选择开始时间!');
+                        return;
+                    }
+                    tempTip.setDuration(99999);
+                    tempTip.waitingTip('生成任务中');
+                    // if (_this.formData.owner_id.length<=0){
+                    //     tempTip.setDuration(1000);
+                    //     tempTip.show('生成盘点任务失败'+'   '+'请先选择货主!');
+                    //     return;
+                    // }
                     let url='{{url('inventory/stockInventory/createStockInventoryMission')}}';
-                    axios.post(url,{formData:_this.formData}).then(function (response) {
-                            if(!response.data.success){
-                                tempTip.setDuration(1000);
-                                tempTip.show('生成盘点任务失败'+'   '+response.data.data);
-                                return;
-                            }else{
-                                let inventory=response.data.data;
-                                _this.inventories.push(inventory);
-                                tempTip.setDuration(2000);
-                                tempTip.showSuccess('生成盘点任务成功!');
-                            }
-                        })
-                        .catch(function (err) {
+                    axios.post(url,{date_end:date_end,date_start:date_start,owner_id:owner_id}).then(function (response) {
+                        tempTip.setDuration(2000);
+                        tempTip.cancelWaitingTip();
+                        if(!response.data.success){
+                            tempTip.setDuration(1000);
+                            tempTip.show('生成盘点任务失败'+'   '+response.data.data);
+                            return;
+                        }else{
+                            let inventory=response.data.data;
+                            //_this.inventories.push(inventory);
+                            tempTip.setDuration(2000);
+                            tempTip.showSuccess('生成盘点任务成功!');
+                            // tempTip.setDuration(99999);
+                            // tempTip.waitingTip('页面跳转中');
+                            location.href='{{url('inventory/stockInventory/enterStockInventory')}}/'+inventory.id;
+                        }
+                    }).catch(function (err) {
                             tempTip.setDuration(3000);
                             tempTip.show('生成盘点任务失败!'+'网络错误:' + err);
                         });
                 },
                 //进入盘点中页面  或者复盘页面
                 enterStockInventory(id){
-                        location.href='{{url('inventory/stockInventory/enterStockInventory')}}/'+id;
+                    location.href='{{url('inventory/stockInventory/enterStockInventory')}}/'+id;
                 },
                 //删除盘点任务
                 deleteStockInventoryMission(id){
@@ -187,6 +228,12 @@
                         tempTip.show('删除失败,网络链接错误!'+err);
                     });
                 },
+                hasDateStart(){
+                  this.date_start=document.getElementById('date_start').value;
+                },
+                hasDateEnd(){
+                    this.date_end=document.getElementById('date_end').value;
+                },
             }
         });
     </script>

+ 20 - 4
resources/views/order/index/delivering.blade.php

@@ -130,9 +130,9 @@
                     </tr>
                 </table>
                 <button type="button" @click="pageUp()" :readonly="page>1?false:true" class="btn btn-sm " :class="page>1?'btn-outline-info':''">上一页</button>
-                <button type="button" @click="pageDown()" :readonly="page<maxPage?false:true" class="btn btn-sm m-3" :class="page<maxPage?'btn-outline-info':''">下一页</button>
-                <input  @keyup.enter="pageSkip($event)" class="form-control-sm ml-3 tooltipTarget" :placeholder="'当前页数:'+page+'/'+maxPage" title="去往指定页">
-                <span class="text-muted m-1">共 @{{ sum }} 条</span>
+                <button type="button" @click="pageDown()" :readonly="maxPage == 0 ? false : (page<maxPage?false:true)" class="btn btn-sm m-3" :class="maxPage == 0 ? 'btn-outline-info' : (page<maxPage?'btn-outline-info':'')">下一页</button>
+                <input  @keyup.enter="pageSkip($event)" class="form-control-sm ml-3 tooltipTarget" :placeholder="pagePlaceholder" title="去往指定页">
+                <span class="text-muted m-1" v-if="maxPage != 0">共 @{{ sum }} 条</span>
             </div>
         </div>
     </div>
@@ -166,6 +166,7 @@
                 ],
                 selectedStyle:'',
                 picktotraceidMap:{!! $picktotraceids !!},
+                pagePlaceholder:"",
             },
             mounted:function () {
                 $(".tooltipTarget").tooltip({'trigger':'hover'});
@@ -174,6 +175,12 @@
                     this.maxPage=Math.ceil(this.orders[0].counted/50);
                     this.sum=this.orders[0].counted;
                 }
+                if (this.getQueryVariable('alternate_sku1')){
+                    this.maxPage=0;
+                    this.pagePlaceholder = '当前页数:'+this.page;
+                }else{
+                    this.pagePlaceholder = '当前页数:'+this.page+'/'+this.maxPage;
+                }
                 let data=[
                     [   {name:'codename_c',type:'select',placeholder:'订单状态',data:this.codes},
                         {name:'orderdate_start',type:'time',tip:['选择显示日期的起始时间','选择显示日期的起始时间'],
@@ -270,12 +277,21 @@
                 }
             },
             methods:{
+               getQueryVariable(variable){
+                    let query = window.location.search.substring(1);
+                    let vars = query.split("&");
+                    for (let i=0;i<vars.length;i++) {
+                        let pair = vars[i].split("=");
+                        if(pair[0] == variable){return pair[1];}
+                    }
+                    return(false);
+                },
                 pageUp(){
                     if (this.page<=1)return;
                     this.href(this.page-1);
                 },
                 pageDown(){
-                    if (this.page>=this.maxPage)return;
+                    if (this.page>=this.maxPage && this.maxPage !== 0)return;
                     this.href(this.page+1);
                 },
                 pageSkip(e){

+ 2 - 2
resources/views/order/issue/import.blade.php

@@ -11,9 +11,9 @@
                     @csrf
                     <div class="form-group row text-center">
                         <div class="col-12 text-danger">
-                            注意:请保证表第一行有以下对应的字段名<br>(可不按顺序):<br>
+                            注意:请保证表第一行有以下对应的字段名<br><span class="text-muted">(可不按顺序):</span><br>
                             原始运单号,情况说明,问题类别<br>
-                            订单问题类别:('拦截', '快递异常', '信息更改', '联系不上', '其他', '错漏发', '仓库问题', '快递丢件', '破损', '撤销丢件', '二次加工', '全检问题', '系统问题', '延迟发货', '仓库丢件', )<br>
+                            <span class="text-muted" style="opacity:0.7"> 订单问题类别:('拦截', '快递异常', '信息更改', '联系不上', '其他', '错漏发', '仓库问题', '快递丢件', '破损', '撤销丢件', '二次加工', '全检问题', '系统问题', '延迟发货', '仓库丢件', )<br></span>
                         </div>
                         <div class="col-12 text-info ">
                             导入时间随文件大小可能达数十分钟以上,请耐心等候

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

@@ -242,7 +242,7 @@
                             <div v-if="orderIssue.order">
                                 <table  class="table table-sm m-0"
                                         v-if="orderIssue.order.packages"
-                                       :class="orderIssue.orderPackagecount > 0  ? 'collapse' : ''"
+                                       :class="orderIssue.orderPackagecount > 1  ? 'collapse' : ''"
                                        :id="'order'+orderIssue.id"
                                        :data-value="orderIssue.orderCount = 0"
                                        :data-count="orderIssue.orderPackagecount = 0">

+ 2 - 2
resources/views/rejected/search/analyze.blade.php

@@ -61,8 +61,8 @@
 
 @section('lastScript')
     <script src="{{asset('js/queryForm/export200818a.js')}}"></script>
-    <script src="{{asset('js/queryForm/queryForm200803a.js')}}"></script>
-    <script type="text/javascript" src="{{asset('js/queryForm/header200826b.js')}}"></script>
+    <script src="{{asset('js/queryForm/queryForm200818a.js')}}"></script>
+    <script type="text/javascript" src="{{asset('js/queryForm/header200819.js')}}"></script>
     <script>
         let vue = new Vue({
             el:"#list",

+ 10 - 6
routes/web.php

@@ -299,20 +299,24 @@ Route::group(['prefix'=>'inventory'],function (){
     Route::post('statement/changeInventory/deleteExcel','InventoryController@deleteExcel');
     //全部库存
     Route::get('statement/allInventory','InventoryController@allInventory');
+
     //库存盘点
-    Route::get('stockInventory/mission','InventoryController@mission');
+    Route::get('stockInventory/mission','InventoryAccountController@mission');
     //创建盘点任务
-    Route::post('stockInventory/createStockInventoryMission','InventoryController@createStockInventoryMission');
+    Route::post('stockInventory/createStockInventoryMission','InventoryAccountController@createStockInventoryMission');
     //删除盘点任务
-    Route::any('deleteStockInventoryMission/{id}','InventoryController@deleteStockInventoryMission');
+    Route::any('deleteStockInventoryMission/{id}','InventoryAccountController@deleteStockInventoryMission');
     //进入盘点或者复盘页面
-    Route::any('stockInventory/enterStockInventory/{id}','InventoryController@enterStockInventory');
+    Route::any('stockInventory/enterStockInventory/{id}','InventoryAccountController@enterStockInventory');
     //盘点任务导出
     Route::any('stockInventoryExport','InventoryController@stockInventoryExport');
-    //盘点库存
     Route::any('stockInventory','InventoryController@stockInventory');
+    //库存体积
+    Route::get('statement/dailyLog','InventoryController@dailyLog');
+    //获取记录监听货主
+    Route::post('statement/dailyLog/getLoggingOwner','InventoryController@getLoggingOwner');
     //复盘查询盘点记录
-    Route::post('searchStockInventoryRecord','InventoryController@searchStockInventoryRecord');
+    Route::post('searchStockInventoryRecord','InventoryAccountController@searchStockInventoryRecord');
 
 
 });

+ 27 - 0
tests/Inventory/Services/InventoryAccountService/InventoryAccountService_ConditionSearchTest.php

@@ -0,0 +1,27 @@
+<?php
+
+
+namespace Tests\Inventory\Services\InventoryAccountService;
+
+
+use App\Services\InventoryAccountService;
+use Tests\TestCase;
+
+class InventoryServiceConditionSearchTest extends TestCase
+{
+    public $data;
+    public $ownerId=null;
+    function testConditionSearchFail(){
+        $inventoryService=new InventoryAccountService();
+        $this->data=$inventoryService->conditionPortStock('','',$this->ownerId);
+        $this->assertNull($this->data);
+    }
+    function testConditionSearchCanSearchData(){
+        $inventoryService=new InventoryAccountService();
+        $this->ownerId=3;
+        $this->data=$inventoryService->conditionPortStock('2020-08-19','2020-08-19',$this->ownerId);
+        $this->assertNotEmpty($this->data);
+    }
+
+}
+

+ 14 - 12
tests/Inventory/Services/InventoryService/InventoryService_CreateInventoryMissionRecordTest.php → tests/Inventory/Services/InventoryAccountService/InventoryAccountService_CreateInventoryMissionRecordTest.php

@@ -1,12 +1,12 @@
 <?php
 
 
-namespace Tests\Inventory\Services\InventoryService;
+namespace Tests\Inventory\Services\InventoryAccountService;
 
 
-use App\Inventory;
-use App\InventoryMission;
-use App\Services\InventoryService;
+use App\InventoryAccount;
+use App\InventoryAccountMission;
+use App\Services\InventoryAccountService;
 use Tests\TestCase;
 
 class InventoryServiceCreateInventoryMissionRecordTest extends TestCase
@@ -14,26 +14,28 @@ class InventoryServiceCreateInventoryMissionRecordTest extends TestCase
 
     public $inventory;
     public $inventoryMissions;
+    public $realService;
+    public $wmsInventoryAccounts;
     function setUp(): void
     {
         parent::setUp(); // TODO: Change the autogenerated stub
-        $this->inventory=factory(Inventory::class)->create();
+        $this->inventory=factory(InventoryAccount::class)->create();
+        $this->realService=new InventoryAccountService();
+        $this->wmsInventoryAccounts=$this->realService->conditionPortStock('2020-08-20','2020-08-20',3);
     }
         function testCreateInventoryMissionsFail(){
-        $realService=new InventoryService();
-        $inventoryMissions=$realService->createInventoryMissionRecord('2020-08-20','2020-08-20','',$this->inventory['id']);
+        $inventoryMissions= $this->realService->createInventoryAccountMissionRecord('',$this->inventory['id'],$this->wmsInventoryAccounts);
         $this->assertNull($inventoryMissions);
     }
     function testCreateInventoryMissionsSuccess(){
-        $realService=new InventoryService();
-        $realService->createInventoryMissionRecord('2020-08-20','2020-08-20',3,$this->inventory['id']);
-        $this->inventoryMissions=InventoryMission::where('inventory_id',$this->inventory['id'])->get();
+        $this->realService->createInventoryAccountMissionRecord(3,$this->inventory['id'],$this->wmsInventoryAccounts);
+        $this->inventoryMissions=InventoryAccountMission::where('inventory_account_id',$this->inventory['id'])->get();
         $this->assertNotEmpty($this->inventoryMissions);
     }
     function tearDown(): void
     {
-        InventoryMission::where('inventory_id',$this->inventory['id'])->delete();
-        Inventory::where('id',$this->inventory['id'])->forceDelete();
+        InventoryAccountMission::where('inventory_account_id',$this->inventory['id'])->delete();
+        InventoryAccount::where('id',$this->inventory['id'])->forceDelete();
         parent::tearDown(); // TODO: Change the autogenerated stub
     }
 

+ 9 - 9
tests/Inventory/Services/InventoryService/InventoryService_CreateMissionTest.php → tests/Inventory/Services/InventoryAccountService/InventoryAccountService_CreateMissionTest.php

@@ -1,15 +1,15 @@
 <?php
 
 
-namespace Tests\Inventory\Services\InventoryService;
+namespace Tests\Inventory\Services\InventoryAccountService;
 
 
-use App\Inventory;
-use App\InventoryMission;
-use App\Services\InventoryService;
+use App\InventoryAccount;
+use App\InventoryAccountMission;
+use App\Services\InventoryAccountService;
 use Tests\TestCase;
 
-class InventoryService_CreateMissionTest extends TestCase
+class InventoryAccountService_CreateMissionTest extends TestCase
 {
 
     public $inventory;
@@ -19,20 +19,20 @@ class InventoryService_CreateMissionTest extends TestCase
         parent::setUp(); // TODO: Change the autogenerated stub
     }
         function testCreateMissionsFail(){
-        $realService=new InventoryService();
+        $realService=new InventoryAccountService();
         $this->inventory=$realService->createMission('2020-08-20','2020-08-20','');
         $this->assertNull($this->inventory);
     }
     function testCreateMissionsSuccess(){
-        $realService=new InventoryService();
+        $realService=new InventoryAccountService();
         $this->inventory=$realService->createMission('2020-08-20','2020-08-20',3);
         $this->assertIsObject($this->inventory);
         $this->assertNotEmpty($this->inventory);
     }
     function tearDown(): void
     {
-        InventoryMission::where('inventory_id',$this->inventory['id'])->delete();
-        Inventory::where('id',$this->inventory['id'])->forceDelete();
+        InventoryAccountMission::where('inventory_account_id',$this->inventory['id'])->delete();
+        InventoryAccount::where('id',$this->inventory['id'])->forceDelete();
         parent::tearDown(); // TODO: Change the autogenerated stub
     }
 

+ 6 - 6
tests/Inventory/Services/InventoryService/InventoryService_GetTest.php → tests/Inventory/Services/InventoryAccountService/InventoryAccountService_GetTest.php

@@ -1,22 +1,22 @@
 <?php
 
 
-namespace Tests\Inventory\Services\InventoryService;
+namespace Tests\Inventory\Services\InventoryAccountService;
 
 
-use App\Inventory;
-use App\Services\InventoryService;
+use App\InventoryAccount;
+use App\Services\InventoryAccountService;
 use Tests\TestCase;
 
-class InventoryService_GetTest extends TestCase
+class InventoryAccountService_GetTest extends TestCase
 {
     public $inventories;
     public $inventorys;
     public $queryParam=[];
     function testGet(){
-        $inventoryService=new InventoryService();
+        $inventoryService=new InventoryAccountService();
         $this->inventories=$inventoryService->get($this->queryParam);
-        $this->inventorys=Inventory::with(['owner'])->orderBy('id','desc')->get();
+        $this->inventorys=InventoryAccount::with(['owner'])->orderBy('id','desc')->get();
         $this->assertEquals(count($this->inventorys),count($this->inventories));
         $this->assertEquals($this->inventorys,$this->inventories);
     }

+ 8 - 8
tests/Inventory/Services/InventoryService/InventoryService_PaginateTest.php → tests/Inventory/Services/InventoryAccountService/InventoryAccountService_PaginateTest.php

@@ -1,23 +1,23 @@
 <?php
 
 
-namespace Tests\Inventory\Services\InventoryService;
+namespace Tests\Inventory\Services\InventoryAccountService;
 
 
-use App\Inventory;
-use App\Services\InventoryService;
+use App\InventoryAccount;
+use App\Services\InventoryAccountService;
 use Tests\TestCase;
 
-class InventoryService_PaginateTest extends TestCase
+class InventoryAccountService_PaginateTest extends TestCase
 {
     public $inventories;
     public $inventorys;
     public $queryParam=[];
     //没有任何搜索条件情况
     function testPaginateSuccess(){
-        $inventoryService=new InventoryService();
+        $inventoryService=new InventoryAccountService();
         $this->inventories=$inventoryService->paginate($this->queryParam);
-        $this->inventorys=Inventory::get();
+        $this->inventorys=InventoryAccount::get();
         $this->assertEquals(count($this->inventorys),$this->inventories->total());
         $this->assertEquals(50,$this->inventories->perPage());
     }
@@ -27,9 +27,9 @@ class InventoryService_PaginateTest extends TestCase
             "owner_id" => "3",
             "paginate" => "100",
         ];
-        $inventoryService=new InventoryService();
+        $inventoryService=new InventoryAccountService();
         $this->inventories=$inventoryService->paginate($this->queryParam);
-        $this->inventorys=Inventory::where('owner_id',3)->get();
+        $this->inventorys=InventoryAccount::where('owner_id',3)->get();
         $this->assertEquals(count($this->inventorys),$this->inventories->total());
         $this->assertEquals(100,$this->inventories->perPage());
     }

+ 11 - 11
tests/Inventory/Services/InventoryService/InventoryService_SearchStockInventoryRecordTest.php → tests/Inventory/Services/InventoryAccountService/InventoryAccountService_SearchStockInventoryRecordTest.php

@@ -1,14 +1,14 @@
 <?php
 
 
-namespace Tests\Inventory\Services\InventoryService;
+namespace Tests\Inventory\Services\InventoryAccountService;
 
 
 use App\Commodity;
 use App\CommodityBarcode;
-use App\Inventory;
-use App\InventoryMission;
-use App\Services\InventoryService;
+use App\InventoryAccount;
+use App\InventoryAccountMission;
+use App\Services\InventoryAccountService;
 use Tests\TestCase;
 
 class InventoryServiceSearchStockInventoryRecordTest extends TestCase
@@ -29,9 +29,9 @@ class InventoryServiceSearchStockInventoryRecordTest extends TestCase
             'code'=>'89898989',
             'commodity_id'=>$this->commodity['id'],
         ]);
-        $this->inventory=factory(Inventory::class)->create();
-        $this->inventoryMission=InventoryMission::create([
-            'inventory_id'=>$this->inventory['id'],
+        $this->inventory=factory(InventoryAccount::class)->create();
+        $this->inventoryMission=InventoryAccountMission::create([
+            'inventory_account_id'=>$this->inventory['id'],
             'location'=>'A21-02-02',
             'commodity_id'=>$this->commodity['id'],
             'produced_at'=>null,
@@ -51,12 +51,12 @@ class InventoryServiceSearchStockInventoryRecordTest extends TestCase
         ]);
     }
     function testSearchStockInventoryNotEmpty(){
-        $inventoryService=new InventoryService();
+        $inventoryService=new InventoryAccountService();
         $inventoryMission=$inventoryService->searchStockInventoryRecord('A21-02-02','89898989',$this->inventory['id']);
         $this->assertNotEmpty($inventoryMission);
     }
     function testSearchStockInventoryEmpty(){
-        $inventoryService=new InventoryService();
+        $inventoryService=new InventoryAccountService();
         $inventoryMission=$inventoryService->searchStockInventoryRecord('','',$this->inventory['id']);
         $this->assertEmpty($inventoryMission);
     }
@@ -65,8 +65,8 @@ class InventoryServiceSearchStockInventoryRecordTest extends TestCase
     {
         CommodityBarcode::where('commodity_id',$this->commodity['id'])->delete();
         Commodity::where('id',$this->commodity['id'])->delete();
-        InventoryMission::where('inventory_id',$this->inventory['id'])->delete();
-        Inventory::where('id',$this->inventory['id'])->forceDelete();
+        InventoryAccountMission::where('inventory_account_id',$this->inventory['id'])->delete();
+        InventoryAccount::where('id',$this->inventory['id'])->forceDelete();
         parent::tearDown(); // TODO: Change the autogenerated stub
     }
 }

+ 10 - 10
tests/Inventory/Services/InventoryService/InventoryService_SomeTest.php → tests/Inventory/Services/InventoryAccountService/InventoryAccountService_SomeTest.php

@@ -1,14 +1,14 @@
 <?php
 
 
-namespace Tests\Inventory\Services\InventoryService;
+namespace Tests\Inventory\Services\InventoryAccountService;
 
 
-use App\Inventory;
-use App\Services\InventoryService;
+use App\InventoryAccount;
+use App\Services\InventoryAccountService;
 use Tests\TestCase;
 
-class InventoryService_SomeTest extends TestCase
+class InventoryAccountService_SomeTest extends TestCase
 {
     public $inventories;
     public $inventorys;
@@ -18,25 +18,25 @@ class InventoryService_SomeTest extends TestCase
     function setUp(): void
     {
         parent::setUp(); // TODO: Change the autogenerated stub
-        $this->first=factory(Inventory::class)->create();
-        $this->second=factory(Inventory::class)->create();
+        $this->first=factory(InventoryAccount::class)->create();
+        $this->second=factory(InventoryAccount::class)->create();
     }
 
     function testSome(){
         $this->queryParam=[
             'data'=>'"'.$this->first['id'].','.$this->second['id'].'"',
         ];
-        $inventoryService=new InventoryService();
+        $inventoryService=new InventoryAccountService();
         $this->inventories=$inventoryService->some($this->queryParam);
-        $this->inventorys=Inventory::query()->with(['owner'])->orderBy('id','DESC')
+        $this->inventorys=InventoryAccount::query()->with(['owner'])->orderBy('id','DESC')
             ->whereIn('id',explode(',','"'.$this->first['id'].','.$this->second['id'].'"'))->get();
         $this->assertEquals(count($this->inventorys),count($this->inventories));
         $this->assertEquals($this->inventorys,$this->inventories);
     }
     function tearDown(): void
     {
-        Inventory::where('id',$this->first['id'])->forceDelete();
-        Inventory::where('id',$this->second['id'])->forceDelete();
+        InventoryAccount::where('id',$this->first['id'])->forceDelete();
+        InventoryAccount::where('id',$this->second['id'])->forceDelete();
         parent::tearDown(); // TODO: Change the autogenerated stub
     }
 

+ 10 - 10
tests/Inventory/Services/InventoryService/InventoryService_StockInventoryTest.php → tests/Inventory/Services/InventoryAccountService/InventoryAccountService_StockInventoryTest.php

@@ -1,14 +1,14 @@
 <?php
 
 
-namespace Tests\Inventory\Services\InventoryService;
+namespace Tests\Inventory\Services\InventoryAccountService;
 
 
 use App\Commodity;
 use App\CommodityBarcode;
-use App\Inventory;
-use App\InventoryMission;
-use App\Services\InventoryService;
+use App\InventoryAccount;
+use App\InventoryAccountMission;
+use App\Services\InventoryAccountService;
 use Tests\TestCase;
 
 class InventoryServiceStockInventoryTest extends TestCase
@@ -29,9 +29,9 @@ class InventoryServiceStockInventoryTest extends TestCase
             'code'=>'89898989',
             'commodity_id'=>$this->commodity['id'],
         ]);
-        $this->inventory=factory(Inventory::class)->create();
-        $this->inventoryMission=InventoryMission::create([
-            'inventory_id'=>$this->inventory['id'],
+        $this->inventory=factory(InventoryAccount::class)->create();
+        $this->inventoryMission=InventoryAccountMission::create([
+            'inventory_account_id'=>$this->inventory['id'],
             'location'=>'A21-02-02',
             'commodity_id'=>$this->commodity['id'],
             'produced_at'=>null,
@@ -51,7 +51,7 @@ class InventoryServiceStockInventoryTest extends TestCase
         ]);
     }
     function testStockInventoryNoDifferenceAndStockSuccess(){
-        $inventoryService=new InventoryService();
+        $inventoryService=new InventoryAccountService();
         $inventoryMission=$inventoryService->stockInventory('A21-02-02','89898989','50',$this->inventory['id']);
         $this->assertEquals('是',$inventoryMission['checked']);
         $this->assertEquals(0,$inventoryMission['difference_amount']);
@@ -62,8 +62,8 @@ class InventoryServiceStockInventoryTest extends TestCase
     {
         CommodityBarcode::where('commodity_id',$this->commodity['id'])->delete();
         Commodity::where('id',$this->commodity['id'])->delete();
-        InventoryMission::where('inventory_id',$this->inventory['id'])->delete();
-        Inventory::where('id',$this->inventory['id'])->forceDelete();
+        InventoryAccountMission::where('inventory_account_id',$this->inventory['id'])->delete();
+        InventoryAccount::where('id',$this->inventory['id'])->forceDelete();
         parent::tearDown(); // TODO: Change the autogenerated stub
     }
 }

+ 0 - 27
tests/Inventory/Services/InventoryService/InventoryService_ConditionSearchTest.php

@@ -1,27 +0,0 @@
-<?php
-
-
-namespace Tests\Inventory\Services\InventoryService;
-
-
-use App\Services\InventoryService;
-use Tests\TestCase;
-
-class InventoryServiceConditionSearchTest extends TestCase
-{
-    public $data;
-    public $ownerId=null;
-    function testConditionSearchFail(){
-        $inventoryService=new InventoryService();
-        $this->data=$inventoryService->conditionSearch('','',$this->ownerId);
-        $this->assertNull($this->data);
-    }
-    function testConditionSearchCanSearchData(){
-        $inventoryService=new InventoryService();
-        $this->ownerId=3;
-        $this->data=$inventoryService->conditionSearch('2020-08-19','2020-08-19',$this->ownerId);
-        $this->assertNotEmpty($this->data);
-    }
-
-}
-

+ 8 - 9
tests/Inventory/http/InventoryControllor/InventoryController_CreateStockInventoryMissionTest.php → tests/Inventory/http/InventoryAccountControllor/InventoryAccountController_CreateStockInventoryMissionTest.php

@@ -5,15 +5,14 @@ namespace Tests\Inventory\Http\InventoryController;
 
 
 use App\Authority;
-use App\Inventory;
-use App\InventoryMission;
-use App\Owner;
+use App\InventoryAccount;
+use App\InventoryAccountMission;
 use App\Role;
 use App\User;
 use Illuminate\Support\Facades\DB;
 use Tests\TestCase;
 
-class InventoryControllerCreateStockInventoryMissionTestMissionTest extends TestCase
+class InventoryAccountController_CreateStockInventoryMissionTest extends TestCase
 {
     public $response=null;
     public $role;
@@ -33,11 +32,11 @@ class InventoryControllerCreateStockInventoryMissionTestMissionTest extends Test
             DB::table('user_role')->insert(['id_user'=>$this->user->id,'id_role'=>$this->role->id]);
         }
         $this->response=$this->actingAs($this->user)->json('post','http://bswas/inventory/stockInventory/createStockInventoryMission/',
-            ['formData'=>[
+            [
                 'date_end'=>'2020-08-17',
                 'date_start'=>'2020-08-17',
-                'owner_id'=>[3],
-            ]]);
+                'owner_id'=>3,
+            ]);
     }
     function testCreateStockInventoryMissionNotHavingException(){
         $this->response->assertDontSee('Exception');
@@ -54,8 +53,8 @@ class InventoryControllerCreateStockInventoryMissionTestMissionTest extends Test
         DB::table('authority_role')->where('id_role',$this->role['id'])->delete();
         User::where('id',$this->user['id'])->delete();
         Role::where('id',$this->role['id'])->delete();
-        InventoryMission::where('inventory_id',$this->response->json()['data']['id'])->delete();
-        Inventory::where('id',$this->response->json()['data']['id'])->forceDelete();
+        InventoryAccountMission::where('inventory_account_id',$this->response->json()['data']['id'])->delete();
+        InventoryAccount::where('id',$this->response->json()['data']['id'])->forceDelete();
         parent::tearDown(); // TODO: Change the autogenerated stub
     }
 }

+ 3 - 3
tests/Inventory/http/InventoryControllor/InventoryController_DeleteStockInventoryMissionTest.php → tests/Inventory/http/InventoryAccountControllor/InventoryAccountController_DeleteStockInventoryMissionTest.php

@@ -5,7 +5,7 @@ namespace Tests\Inventory\Http\InventoryController;
 
 
 use App\Authority;
-use App\Inventory;
+use App\InventoryAccount;
 use App\Owner;
 use App\Role;
 use App\User;
@@ -30,7 +30,7 @@ class InventoryControllerDeleteStockInventoryMissionTestMissionTest extends Test
             $authority= Authority::where('name','库存管理-盘点')->first();
             DB::table('authority_role')->insert(['id_authority'=>$authority->id,'id_role'=>$this->role->id]);
             DB::table('user_role')->insert(['id_user'=>$this->user->id,'id_role'=>$this->role->id]);
-            $this->inventory=factory(Inventory::class)->create();
+            $this->inventory=factory(InventoryAccount::class)->create();
         }
         $this->response=$this->actingAs($this->user)->json('delete','http://bswas/inventory/deleteStockInventoryMission/'.$this->inventory['id']);
     }
@@ -47,7 +47,7 @@ class InventoryControllerDeleteStockInventoryMissionTestMissionTest extends Test
         DB::table('authority_role')->where('id_role',$this->role['id'])->delete();
         User::where('id',$this->user['id'])->delete();
         Role::where('id',$this->role['id'])->delete();
-        Inventory::where('id',$this->inventory['id'])->forceDelete();
+        InventoryAccount::where('id',$this->inventory['id'])->forceDelete();
         parent::tearDown(); // TODO: Change the autogenerated stub
     }
 }

+ 10 - 10
tests/Inventory/http/InventoryControllor/InventoryController_EnterStockInventoryTest.php → tests/Inventory/http/InventoryAccountControllor/InventoryAccountController_EnterStockInventoryTest.php

@@ -6,11 +6,11 @@ namespace Tests\Inventory\Http\InventoryController;
 
 use App\Authority;
 use App\Commodity;
-use App\Inventory;
-use App\InventoryMission;
+use App\InventoryAccount;
+use App\InventoryAccountMission;
 use App\Owner;
 use App\Role;
-use App\Services\InventoryService;
+use App\Services\InventoryAccountService;
 use App\Services\UnitService;
 use App\User;
 use Illuminate\Database\Eloquent\Collection;
@@ -37,11 +37,11 @@ class InventoryControllerEnterStockInventoryMissionTestTest extends TestCase
             $authority= Authority::where('name','库存管理-盘点')->first();
             DB::table('authority_role')->insert(['id_authority'=>$authority->id,'id_role'=>$this->role->id]);
             DB::table('user_role')->insert(['id_user'=>$this->user->id,'id_role'=>$this->role->id]);
-            $this->inventory=factory(Inventory::class)->create();
+            $this->inventory=factory(InventoryAccount::class)->create();
             $total=$this->inventory['total'];
             for ($i=0;$i<$total;$i++){
-                $this->inventoryMissions=InventoryMission::create([
-                    'inventory_id'=>$this->inventory['id'],
+                $this->inventoryMissions=InventoryAccountMission::create([
+                    'inventory_account_id'=>$this->inventory['id'],
                     'location'=>Str::random(5),
                     'commodity_id'=>256226,
                     'produced_at'=>null,
@@ -74,8 +74,8 @@ class InventoryControllerEnterStockInventoryMissionTestTest extends TestCase
     function testStockInventoryViewHasInventoryAndInventoryMissions(){
         //$inventory=Inventory::with('owner')->find($this->inventory['id']);
         //$inventoryMissions=InventoryMission::with(['commodity'])->where('inventory_id',$this->inventory['id'])->orderBy('difference_amount','desc')->get();
-        $this->response->assertViewHas('inventoryMissions');
-        $this->response->assertViewHas('inventory');
+        $this->response->assertViewHas('inventoryAccountMissions');
+        $this->response->assertViewHas('inventoryAccount');
     }
     function tearDown(): void
     {
@@ -83,8 +83,8 @@ class InventoryControllerEnterStockInventoryMissionTestTest extends TestCase
         DB::table('authority_role')->where('id_role',$this->role['id'])->delete();
         User::where('id',$this->user['id'])->delete();
         Role::where('id',$this->role['id'])->delete();
-        InventoryMission::where('inventory_id',$this->inventory['id'])->delete();
-        Inventory::where('id',$this->inventory['id'])->forceDelete();
+        InventoryAccountMission::where('inventory_account_id',$this->inventory['id'])->delete();
+        InventoryAccount::where('id',$this->inventory['id'])->forceDelete();
         parent::tearDown(); // TODO: Change the autogenerated stub
     }
 }

+ 1 - 1
tests/Inventory/http/InventoryControllor/InventoryController_MissionTest.php → tests/Inventory/http/InventoryAccountControllor/InventoryAccountController_MissionTest.php

@@ -44,7 +44,7 @@ class InventoryControllerMissionTest extends TestCase
         $this->response->assertViewHas('owners',$owners);
     }
     function testMissionHasInventories(){
-        $this->response->assertViewHas('inventories');
+        $this->response->assertViewHas('inventoryAccounts');
     }
 
     function tearDown(): void

+ 7 - 7
tests/Inventory/http/InventoryControllor/InventoryController_SearchStockInventoryRecordTest.php → tests/Inventory/http/InventoryAccountControllor/InventoryAccountController_SearchStockInventoryRecordTest.php

@@ -5,8 +5,8 @@ namespace Tests\Inventory\Http\InventoryController;
 
 
 use App\Authority;
-use App\Inventory;
-use App\InventoryMission;
+use App\InventoryAccount;
+use App\InventoryAccountMission;
 use App\Owner;
 use App\Role;
 use App\User;
@@ -33,9 +33,9 @@ class InventoryController_SearchStockInventoryRecordTest extends TestCase
             $authority= Authority::where('name','库存管理-盘点')->first();
             DB::table('authority_role')->insert(['id_authority'=>$authority->id,'id_role'=>$this->role->id]);
             DB::table('user_role')->insert(['id_user'=>$this->user->id,'id_role'=>$this->role->id]);
-            $this->inventory=factory(Inventory::class)->create();
-            $this->inventoryMissions=InventoryMission::create([
-                'inventory_id'=>$this->inventory['id'],
+            $this->inventory=factory(InventoryAccount::class)->create();
+            $this->inventoryMissions=InventoryAccountMission::create([
+                'inventory_account_id'=>$this->inventory['id'],
                 'location'=>'A12-10-01',
                 'commodity_id'=>256226,
                 'produced_at'=>null,
@@ -76,8 +76,8 @@ class InventoryController_SearchStockInventoryRecordTest extends TestCase
         DB::table('authority_role')->where('id_role',$this->role['id'])->delete();
         User::where('id',$this->user['id'])->delete();
         Role::where('id',$this->role['id'])->delete();
-        InventoryMission::where('inventory_id',$this->inventory['id'])->delete();
-        Inventory::where('id',$this->inventory['id'])->forceDelete();
+        InventoryAccountMission::where('inventory_account_id',$this->inventory['id'])->delete();
+        InventoryAccount::where('id',$this->inventory['id'])->forceDelete();
         parent::tearDown(); // TODO: Change the autogenerated stub
     }
 }

+ 7 - 7
tests/Inventory/http/InventoryControllor/InventoryController_StockInventoryTest.php → tests/Inventory/http/InventoryAccountControllor/InventoryAccountController_StockInventoryTest.php

@@ -5,8 +5,8 @@ namespace Tests\Inventory\Http\InventoryController;
 
 
 use App\Authority;
-use App\Inventory;
-use App\InventoryMission;
+use App\InventoryAccount;
+use App\InventoryAccountMission;
 use App\Owner;
 use App\Role;
 use App\User;
@@ -32,9 +32,9 @@ class InventoryControllerStockInventoryMissionTestTest extends TestCase
             $authority= Authority::where('name','库存管理-盘点')->first();
             DB::table('authority_role')->insert(['id_authority'=>$authority->id,'id_role'=>$this->role->id]);
             DB::table('user_role')->insert(['id_user'=>$this->user->id,'id_role'=>$this->role->id]);
-            $this->inventory=factory(Inventory::class)->create();
-            $this->inventoryMissions=InventoryMission::create([
-                'inventory_id'=>$this->inventory['id'],
+            $this->inventory=factory(InventoryAccount::class)->create();
+            $this->inventoryMissions=InventoryAccountMission::create([
+                'inventory_account_id'=>$this->inventory['id'],
                 'location'=>'A12-10-01',
                 'commodity_id'=>256226,
                 'produced_at'=>null,
@@ -84,8 +84,8 @@ class InventoryControllerStockInventoryMissionTestTest extends TestCase
         DB::table('authority_role')->where('id_role',$this->role['id'])->delete();
         User::where('id',$this->user['id'])->delete();
         Role::where('id',$this->role['id'])->delete();
-        InventoryMission::where('inventory_id',$this->inventory['id'])->delete();
-        Inventory::where('id',$this->inventory['id'])->forceDelete();
+        InventoryAccountMission::where('inventory_account_id',$this->inventory['id'])->delete();
+        InventoryAccount::where('id',$this->inventory['id'])->forceDelete();
         parent::tearDown(); // TODO: Change the autogenerated stub
     }
 }

+ 12 - 12
tests/Inventory/model/InventoryTest.php → tests/Inventory/model/InventoryAccountTest.php

@@ -4,14 +4,14 @@
 namespace Tests\Inventory\model;
 
 
-use App\Inventory;
-use App\InventoryMission;
+use App\InventoryAccount;
+use App\InventoryAccountMission;
 use Illuminate\Support\Str;
 use Tests\TestCase;
 
 
 
-class InventoryTest extends TestCase
+class InventoryAccountTest extends TestCase
 {
 
     public $inventory;
@@ -19,11 +19,11 @@ class InventoryTest extends TestCase
     function setUp(): void
     {
         parent::setUp(); // TODO: Change the autogenerated stub
-        $this->inventory=factory(Inventory::class)->create();
+        $this->inventory=factory(InventoryAccount::class)->create();
         $total=$this->inventory['total'];
         for ($i=0;$i<$total;$i++){
-            $this->inventoryMissions=InventoryMission::create([
-                'inventory_id'=>$this->inventory['id'],
+            $this->inventoryMissions=InventoryAccountMission::create([
+                'inventory_account_id'=>$this->inventory['id'],
                 'location'=>Str::random(5),
                 'commodity_id'=>256226,
                 'produced_at'=>null,
@@ -49,29 +49,29 @@ class InventoryTest extends TestCase
     }
 
     function testInventoryMissions(){
-        $this->assertEquals($this->inventory->id,$this->inventory->inventoryMissions['inventory_id']);
+        $this->assertEquals($this->inventory->id,$this->inventory->inventoryMissions['inventory_account_id']);
     }
     function testGetSurplusAttribute(){
         $surplus=$this->inventory['surplus'];
         $this->assertEquals($surplus,$this->inventory['total']-$this->inventory['processed']);
     }
     function testGetProcessedAmount(){
-        $processed=InventoryMission::where('inventory_id',$this->inventory['id'])->where('checked','是')->count();
+        $processed=InventoryAccountMission::where('inventory_account_id',$this->inventory['id'])->where('checked','是')->count();
         $this->assertEquals($processed,$this->inventory['processed']);
     }
     function testGetDifferenceAmount(){
-        $difference=InventoryMission::where('inventory_id',$this->inventory['id'])->where('difference_amount','>',0)->count();
+        $difference=InventoryAccountMission::where('inventory_account_id',$this->inventory['id'])->where('difference_amount','>',0)->count();
         $this->assertEquals($difference,$this->inventory['difference']);
     }
     function testGetReturnedAmount(){
-        $returned=InventoryMission::where('inventory_id',$this->inventory['id'])->where('returned','是')->count();
+        $returned=InventoryAccountMission::where('inventory_account_id',$this->inventory['id'])->where('returned','是')->count();
         $this->assertEquals($returned,$this->inventory['returned']);
     }
 
     function tearDown(): void
     {
-        InventoryMission::where('inventory_id',$this->inventory['id'])->delete();
-        Inventory::where('id',$this->inventory['id'])->forceDelete();
+        InventoryAccountMission::where('inventory_account_id',$this->inventory['id'])->delete();
+        InventoryAccount::where('id',$this->inventory['id'])->forceDelete();
         parent::tearDown(); // TODO: Change the autogenerated stub
     }
 }