浏览代码

Merge branch 'master' into zzd

# Conflicts:
#	app/Commodity.php
#	app/Http/Controllers/OrderController.php
#	app/Http/Controllers/TestController.php
#	app/Services/OrderIssueService.php
#	app/Services/RejectedService.php
#	app/Services/common/QueryService.php
dream 5 年之前
父节点
当前提交
3022ef32f0
共有 100 个文件被更改,包括 3693 次插入1458 次删除
  1. 6 7
      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. 86 15
      app/Http/Controllers/InventoryController.php
  6. 9 9
      app/Http/Controllers/InventoryMissionController.php
  7. 37 4
      app/Http/Controllers/OrderController.php
  8. 141 116
      app/Http/Controllers/OrderIssueController.php
  9. 1 1
      app/Http/Controllers/OrderIssueProcessLogController.php
  10. 0 2
      app/Http/Controllers/RejectedBillItemController.php
  11. 4 4
      app/Http/Controllers/RejectedController.php
  12. 12 2
      app/Http/Controllers/RoleController.php
  13. 13 2
      app/Http/Controllers/UserController.php
  14. 1 1
      app/Http/Controllers/UserLaborController.php
  15. 1 0
      app/Http/Controllers/WaveController.php
  16. 36 41
      app/Imports/OrderIssueImport.php
  17. 0 30
      app/Inventory.php
  18. 46 0
      app/InventoryAccount.php
  19. 2 2
      app/InventoryAccountMission.php
  20. 20 0
      app/InventoryDailyLog.php
  21. 16 0
      app/InventoryDailyLoggingOwner.php
  22. 1 1
      app/OperatorLog.php
  23. 2 2
      app/OracleDOCOrderHeader.php
  24. 51 39
      app/Order.php
  25. 2 3
      app/OrderIssue.php
  26. 1 2
      app/OrderIssueOnTop.php
  27. 0 1
      app/OrderPackage.php
  28. 18 13
      app/RejectedBill.php
  29. 4 2
      app/RejectedBillItem.php
  30. 18 0
      app/Services/CommodityService.php
  31. 237 0
      app/Services/InventoryAccountService.php
  32. 34 0
      app/Services/InventoryService.php
  33. 152 157
      app/Services/OrderIssueService.php
  34. 50 17
      app/Services/OrderPackageCommoditiesService.php
  35. 37 18
      app/Services/OrderPackageService.php
  36. 27 57
      app/Services/OrderService.php
  37. 7 3
      app/Services/RejectedService.php
  38. 6 8
      app/Services/WaveService.php
  39. 2 2
      app/Services/common/QueryService.php
  40. 10 0
      app/Validators/UserDutyCheckValidator.php
  41. 2 2
      app/library/baidu-api-speech/lib/AipBCEUtil.php
  42. 23 0
      database/factories/InventoryFactory.php
  43. 31 0
      database/factories/InventoryMissionFactory.php
  44. 2 1
      database/factories/UserFactory.php
  45. 39 0
      database/migrations/2020_08_20_172156_add_order_client_no.php
  46. 46 0
      database/migrations/2020_08_25_180030_create_inventory_daily_logs_table.php
  47. 33 0
      database/migrations/2020_08_25_180623_create_inventory_daily_logging_owners_table.php
  48. 38 0
      database/migrations/2020_08_25_180803_change_commodities_add_column_length_width_height_volumn.php
  49. 49 0
      database/migrations/2020_08_26_093946_change_inventory_missions_to_inventory_account_missions.php
  50. 41 0
      database/migrations/2020_08_26_094015_change_inventories_to_inventory_accounts.php
  51. 1 0
      phpunit-Inventory.bat
  52. 3 0
      phpunit.xml
  53. 5 5
      public/js/app.js
  54. 14 3
      resources/js/queryForm/header.js
  55. 4 4
      resources/js/queryForm/queryForm.js
  56. 1 1
      resources/js/utilities/tempTip.js
  57. 0 200
      resources/views/inventory/statement/allInventory.blade.php
  58. 7 5
      resources/views/inventory/statement/changeInventory.blade.php
  59. 248 0
      resources/views/inventory/statement/dailyLog.blade.php
  60. 4 0
      resources/views/inventory/statement/menu.blade.php
  61. 72 31
      resources/views/inventory/stockInventory/inventoryMission.blade.php
  62. 129 55
      resources/views/inventory/stockInventory/mission.blade.php
  63. 12 2
      resources/views/maintenance/role/index.blade.php
  64. 30 11
      resources/views/maintenance/user/index.blade.php
  65. 29 11
      resources/views/order/index/delivering.blade.php
  66. 100 158
      resources/views/order/issue/create.blade.php
  67. 106 62
      resources/views/order/issue/edit.blade.php
  68. 3 3
      resources/views/order/issue/import.blade.php
  69. 455 290
      resources/views/order/issue/index.blade.php
  70. 2 2
      resources/views/order/wave/search.blade.php
  71. 1 1
      resources/views/personnel/checking-in/missionAudit.blade.php
  72. 17 5
      resources/views/personnel/laborReport/index.blade.php
  73. 3 3
      resources/views/process/index.blade.php
  74. 2 2
      resources/views/process/statistic.blade.php
  75. 2 2
      resources/views/rejected/recycle.blade.php
  76. 2 2
      resources/views/rejected/search/analyze.blade.php
  77. 3 3
      resources/views/rejected/search/general.blade.php
  78. 1 1
      resources/views/store/index.blade.php
  79. 1 1
      resources/views/store/storeItem/index.blade.php
  80. 3 3
      resources/views/waybill/delivering.blade.php
  81. 3 3
      resources/views/waybill/index.blade.php
  82. 2 2
      resources/views/waybill/waybillFinancialSnapshot/index.blade.php
  83. 3 3
      resources/views/weight/package/index.blade.php
  84. 2 2
      resources/views/weight/package/statistics.blade.php
  85. 2 2
      resources/views/weight/weightExcepted/index.blade.php
  86. 14 13
      routes/apiLocal.php
  87. 16 3
      routes/web.php
  88. 21 0
      tests/Inventory/ExampleTest.php
  89. 27 0
      tests/Inventory/Services/InventoryAccountService/InventoryAccountService_ConditionSearchTest.php
  90. 118 0
      tests/Inventory/Services/InventoryAccountService/InventoryAccountService_CreateInventoryMissionRecordTest.php
  91. 45 0
      tests/Inventory/Services/InventoryAccountService/InventoryAccountService_CreateMissionTest.php
  92. 24 0
      tests/Inventory/Services/InventoryAccountService/InventoryAccountService_GetTest.php
  93. 39 0
      tests/Inventory/Services/InventoryAccountService/InventoryAccountService_PaginateTest.php
  94. 73 0
      tests/Inventory/Services/InventoryAccountService/InventoryAccountService_SearchStockInventoryRecordTest.php
  95. 45 0
      tests/Inventory/Services/InventoryAccountService/InventoryAccountService_SomeTest.php
  96. 70 0
      tests/Inventory/Services/InventoryAccountService/InventoryAccountService_StockInventoryTest.php
  97. 60 0
      tests/Inventory/http/InventoryAccountControllor/InventoryAccountController_CreateStockInventoryMissionTest.php
  98. 53 0
      tests/Inventory/http/InventoryAccountControllor/InventoryAccountController_DeleteStockInventoryMissionTest.php
  99. 91 0
      tests/Inventory/http/InventoryAccountControllor/InventoryAccountController_EnterStockInventoryTest.php
  100. 58 0
      tests/Inventory/http/InventoryAccountControllor/InventoryAccountController_MissionTest.php

+ 6 - 7
app/Commodity.php

@@ -9,8 +9,8 @@ use App\Traits\ModelTimeFormat;
 class Commodity extends Model
 {
     use ModelTimeFormat;
-    protected $fillable=['name','sku','owner_id','created_at'];
-    //protected $appends=['barcode','owner_name','owner_code'];
+    protected $fillable=['name','sku','owner_id','created_at','length','width','height','volumn'];
+    protected $appends=['barcode','owner_name','owner_code'];
 
     public function barcodes()
     {
@@ -20,13 +20,13 @@ 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(){
-        return $this->owner()->first()['name'];
+        return $this->owner['name']??'';
     }
     public function getOwnerCodeAttribute(){
-        return $this['owner'] ? $this['owner']['code'] : null;
+        return $this->owner['code']??'';
     }
 
     static function newCommodityBy_BarcodeOwnerIdNameSku($barcode,$ownerId,$name,$sku){
@@ -45,7 +45,7 @@ class Commodity extends Model
             if($commodity)$commodities[]=$commodity;
         }
 
-        if(count($barcodes)==count($commodities)&&count($commodities)>0){//过滤掉仅有一个条码相等的。
+        if(count($barcodes)==count($commodities)&&count($commodities)>0){//筛选掉仅有一个条码相等的。
             $commodity=$commodities[0];
         }else{
             $commodity=null;
@@ -63,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('inventoryService',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('inventoryService')->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('inventoryService')->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('inventoryService')->stockInventory($location,$barcode,$count,$inventoryId);
+        if (!$inventoryAccountMission)return ['success'=>false,'data'=>'参数错误!'];
+        $inventoryAccount=app('inventoryService')->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('inventoryService')->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('inventoryService')->get($queryParam);
+        }else{
+            $queryParam=$request->all();
+            $inventoryAccounts=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($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');
+    }
+}

+ 86 - 15
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;
@@ -17,8 +20,9 @@ class InventoryController extends Controller
 {
     public function __construct()
     {
-        app()->singleton('inventoryService',InventoryService::class);
+        app()->singleton('inventoryService',InventoryAccountService::class);
     }
+    //动库表表
     private function conditionQuery(Request $request,$page=null,$paginate=null){
         $date_start=$request->input('date_start');
         $range = $request->input('range');
@@ -92,6 +96,54 @@ class InventoryController extends Controller
         if ($page&&$paginate)$sql.="  where rn>'".($page-1)*$paginate."'";
         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);
+    }
     //动库报表
     public function changeInventory(Request $request){
         if(!Gate::allows("库存管理-库存")){ return redirect(url('/'));  }
@@ -100,17 +152,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('/'));  }
@@ -152,8 +206,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]['占用数量'],
             ];
@@ -197,15 +251,6 @@ class InventoryController extends Controller
         return ['success'=>true,'inventoryMission'=>$inventoryMission,'inventory'=>$inventory];
     }
 
-
-
-
-
-
-
-
-
-
     //盘点任务导出
     public function stockInventoryExport(Request $request){
         if (!Gate::allows('库存管理-盘点')){return redirect(url('/')); }
@@ -250,4 +295,30 @@ class InventoryController extends Controller
         }
         return Excel::download(new Export($row,$list),date('YmdHis', time()).'-盘点任务记录单.xlsx');
     }
+
+    /*
+     *  库存体积
+     */
+    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'));
+    }
+
+    //获取记录监听货主
+    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 - 4
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,8 +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."%'";
-
         if ($checkData || $export){
             return response(Http::post(config('go.export.url'),['type'=>'order','sql'=>$sql]),200, [
                 "Content-type"=>"application/octet-stream",
@@ -214,10 +231,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('/'));  }

+ 141 - 116
app/Http/Controllers/OrderIssueController.php

@@ -6,11 +6,13 @@ use App\Exports\Export;
 use App\Imports\OrderIssueExport;
 use App\Imports\OrderIssueImport;
 use App\Logistic;
+use App\OracleDOCOrderHeader;
 use App\Order;
 use App\OrderIssue;
 use App\OrderIssueProcessLog;
 use App\OrderIssueType;
 use App\Owner;
+use App\QualityLabel;
 use App\RejectedBill;
 use App\Services\OrderIssueService;
 use App\Services\OrderService;
@@ -32,7 +34,6 @@ class OrderIssueController extends Controller
         app()->singleton("orderIssueService", OrderIssueService::class);
         app()->singleton("orderService", OrderService::class);
         app()->singleton("rejectedService", RejectedService::class);
-        app()->singleton('rejectedService',RejectedService::class);
     }
 
     public function index(Request $request)
@@ -42,8 +43,10 @@ class OrderIssueController extends Controller
         }
         $orderIssueService = app('orderIssueService');
         $owners = Owner::all();
-        $orderIssues = $orderIssueService->paginate($request);
-        return view('order.issue.index', compact('owners', 'orderIssues'));
+        $orderIssues = $orderIssueService->paginate($request->all());
+        $orderIssueType = OrderIssueType::all();
+        $qualityLabel = QualityLabel::all();
+        return view('order.issue.index', compact('owners', 'orderIssues', 'orderIssueType', 'qualityLabel'));
     }
 
     public function create()
@@ -68,9 +71,9 @@ class OrderIssueController extends Controller
         $orderIssueService->validatorCreate($request)->validate();
         $orderIssue = null;
         if ($request->filled('logistic_number_return')) {
-            $orderIssue = $orderIssueService->createByLogisticNumber($request);
+            $orderIssue = $orderIssueService->createByLogisticNumber($request->all());
         } else {
-            $orderIssue = $orderIssueService->create($request);
+            $orderIssue = $orderIssueService->create($request->all());
         }
         $msg = '';
         if ($orderIssue == null) {
@@ -79,7 +82,7 @@ class OrderIssueController extends Controller
             $msg = '创建订单问题件成功';
         }
         $owners = Owner::all();
-        $orderIssues = $orderIssueService->paginate($request);
+        $orderIssues = $orderIssueService->paginate($request->all());
         OrderIssueProcessLog::create(['order_issue_id' => $orderIssue['id'], 'user_id' => Auth::user()['id'], 'content' => '创建订单问题件', 'type' => '创建']);
         return redirect('order/issue/index'); /*view('order.issue.index', compact('owners', 'orderIssues', 'msg'))*/;
     }
@@ -95,19 +98,17 @@ class OrderIssueController extends Controller
                 return $query->with('commodity');
             }]);
         }])->where('id', $orderIssue->order_id)->first();
-        $secondOrder = Order::with(['packages'=>function($query){
-            return $query->with(['commodities'=>function($query){
+        $secondOrder = Order::with(['packages' => function ($query) {
+            return $query->with(['commodities' => function ($query) {
                 return $query->with(['commodity']);
             }]);
         }])->where('id', $orderIssue->second_order_id)->first();
         $rejectedBill = RejectedBill::where('id', $orderIssue->rejected_bill_id)->first();
         $userWorkgroup = UserWorkgroup::all();
         $orderIssueType = OrderIssueType::all();
-
         $owners = Owner::all();
         $shops = Shop::all();
         $logistics = Logistic::all();
-//        return view('order/issue/edit', compact(['orderIssue', 'owners', 'userWorkgroup', 'shops', 'logistics', 'orderIssueType',]));
         return view('order/issue/edit', compact(['orderIssue', 'owners', 'userWorkgroup', 'shops', 'logistics', 'orderIssueType', 'order', 'secondOrder', 'rejectedBill']));
     }
 
@@ -127,13 +128,13 @@ class OrderIssueController extends Controller
             return redirect(url('/'));
         }
         $file = $request->file('file');
-        $fileSuffix = $request->file('file')->getClientOriginalExtension();
+        $fileSuffix = $file->getClientOriginalExtension();
         if (in_array($fileSuffix, ['xlsx', 'xlsm', 'xltx', 'xltm', 'xls', 'xlt', 'ods', 'ots', 'slk', 'xml', 'gnumeric', 'htm', 'html', 'csv', 'tsv'])) {
             ini_set('max_execution_time', 2100);
             ini_set('memory_limit', '512M');
             $extension = $request->file()['file']->getClientOriginalExtension();
             $extension[0] = strtoupper($extension[0]);
-            Excel::import(new OrderIssueImport(), $request->file()['file']->path(), null, $extension);
+            Excel::import(new OrderIssueImport(), $request->file('file')->path(), null, $extension);
             if (Cache::has('error')) {
                 return '<h1 class="text-danger">导入Excel失败<br><p style="color: red">' . Cache::pull('error') . '</p></h1>';
             } else {
@@ -153,21 +154,17 @@ class OrderIssueController extends Controller
     public function exportOrderIssue(Request $request)
     {
         $orderIssueService = app('orderIssueService');
-        $resultdata = $orderIssueService->exportExcel($request);
-
+        $resultData = $orderIssueService->exportExcel($request);
         $row = [[
-            'id' => 'ID', 'created_at' => '状态', 'order_created_at' => '登记日期', 'owner' => '客户', 'shop' => '店铺', 'order_no' => '原始订单号',
-            'logistic' => '原始承运商', 'consignee_name' => '收货人', 'consignee_phone' => '收货电话',
+            'id' => 'ID', 'order_created_at' => '登记日期', 'created_at' => '创建日期', 'owner' => '客户', 'shop' => '店铺', 'client_code' => '客户订单号',
+            'logistic' => '原始承运商', 'logistic_number' => '原始运单号', 'consignee_name' => '收货人', 'consignee_phone' => '收货电话',
             'province' => '省', 'city' => '市', 'district' => '区', 'address' => '收货人地址',
-// 原始商品信息order -> package -> commodity
             'commodity_code' => '商品条码', 'commodity_name' => '商品名称', 'amount' => '数量',
-// 退回商品信息 rejectedBill -> items
             'barcode_goods' => '商品条码', 'name_goods' => '商品名称', 'goods_amount' => '数量', 'is_checked' => '是否正品', 'remark' => '备注',
-            'rejecting_status'=>'退单状态',
-            'logtype'=>'操作类型','logremark'=>'说明','user'=>'操作者',
+            'rejecting_status' => '退单状态',
+            'logtype' => '操作类型', 'logremark' => '说明', 'user' => '操作者',
             'order_issue_type' => '问题类别',
             'second_order' => '二次订单', 'second_logistic' => '二次承运商', 'second_logistic_number' => '二次运单号',
-// 二次商品信息 order -> package -> commodity
             's_commodity_code' => '条码', 's_commodity_name' => '商品名', 's_amount' => '数量', /*'s_is_checked' => '是否正品', 's_remark' => '备注',*/
             'final_status' => '最终状态', 'logistic_indemnity_money' => '承运商赔偿金额', 'logistic_express_remission' => '承运商快递减免',
             'baoshi_indemnity_money' => '宝时赔偿金额', 'baoshi_express_remission' => '宝时快递减免', 'user_workgroup' => '事故责任方']];
@@ -175,15 +172,13 @@ class OrderIssueController extends Controller
         $list = [];
         $mergeCell = [];
         $i = 0;
-        foreach ($resultdata as $result) {
+        foreach ($resultData as $result) {
             $count = 0;
             $list[$i] = [
                 'id' => $result->id,
                 'created_at' => $result->created_at,    // 登记日期
                 'order_created_at' => isset($result->order) ? $result->order->created_at : '', // 订单创建日期
-                'owner' => isset($result->owner) ? $result->owner->name : '',   // 货主
-                'shop' => isset($result->shop) ? $result->shop->name : '',      // 店铺
-                'final_status' => $result->final_status,                        // 最终处理结果
+                'final_status' => $result->final_status,     // 最终处理结果
                 'order_issue_type' => isset($result->type) ? $result->type->name : '',
                 'logistic_indemnity_money' => $result->logistic_indemnity_money,
                 'logistic_express_remission' => $result->logistic_express_remission,
@@ -192,8 +187,10 @@ class OrderIssueController extends Controller
                 'user_workgroup' => isset($result->userWorkGroup) ? $result->userWorkGroup->name : '',
                 'rejecting_status' => isset($result->rejecting_status) ? $result->rejecting_status : '',
             ];
-            $sign=$i+2;
+            $sign = $i + 2;
             if (isset($result->order)) {
+                $list[$i]['shop'] = $result->order->shop ? $result->order->shop->name : '';// 店铺
+                $list[$i]['owner'] = $result->order->owner ? $result->order->owner->name : '';// 货主
                 $list[$i]['logistic'] = $result->order->logistic ? $result->order->logistic->name : '';
                 $list[$i]['consignee_name'] = $result->order->consignee_name;
                 $list[$i]['consignee_phone'] = $result->order->consignee_phone;
@@ -201,34 +198,35 @@ class OrderIssueController extends Controller
                 $list[$i]['city'] = $result->order->city;
                 $list[$i]['district'] = $result->order->district;
                 $list[$i]['address'] = $result->order->address;
-                $list[$i]['order_no'] = $result->order->code;
+                $list[$i]['client_code'] = $result->order->client_code;
+                $list[$i]['logisticNumbers'] = $result->order->logistic_number;
                 $cell = $i;
                 if (isset($result->order->packages)) {
                     $packages = $result->order->packages;
                     foreach ($packages as $key => $value) {
-                        if(isset($value->commodities)){
+                        if (isset($value->commodities)) {
                             $commodities = $value->commodities;
-                            foreach($commodities as $commodity){
-                                $list[$cell]['commodity_code'] = isset($commodity->commodity)? $commodity->commodity->sku:'';
-                                $list[$cell]['commodity_name'] = isset($commodity->commodity)?$commodity->commodity->name :'';
+                            foreach ($commodities as $commodity) {
+                                $list[$cell]['commodity_code'] = isset($commodity->commodity) ? $commodity->commodity->sku : '';
+                                $list[$cell]['commodity_name'] = isset($commodity->commodity) ? $commodity->commodity->name : '';
                                 $list[$cell]['amount'] = $commodity->amount;
+                                $cell++;
                             }
                         }
-                        $cell++;
                     }
                     $count = $cell - $i;
                 }
             }
-            if(isset($result->logs)){
+            if (isset($result->logs)) {
                 $logs = $result->logs;
                 $cell = $i;
-                foreach ($logs as $log){
+                foreach ($logs as $log) {
                     $list[$cell]['logtype'] = $log->type;
-                    $list[$cell]['logremark'] =$log->content;
-                    $list[$cell]['user'] = isset($log->user) ? $log->user->name:"";
+                    $list[$cell]['logremark'] = $log->content;
+                    $list[$cell]['user'] = isset($log->user) ? $log->user->name : "";
                     $cell++;
                 }
-                $count = $cell - $i > $count ?  $cell - $i : $count;
+                $count = $cell - $i > $count ? $cell - $i : $count;
             }
             if (isset($result->secondOrder)) {
                 $list[$i]['second_order'] = $result->secondOrder->code;
@@ -236,20 +234,20 @@ class OrderIssueController extends Controller
                 $list[$i]['second_logistic_number'] = $result->secondOrder->code;
                 $secondOrder = $result->secondOrder;
                 if (isset($secondOrder->secondOrder->packages)) {
-                    $spackages = $result->order->packages;
+                    $packages = $result->order->packages;
                     $cell = $i;
-                    foreach ($spackages as $key => $value) {
-                        if(isset($value->commodities)){
+                    foreach ($packages as $key => $value) {
+                        if (isset($value->commodities)) {
                             $commodities = $value->commodities;
-                            foreach($commodities as $commodity){
-                                $list[$cell]['s_commodity_code'] = isset($commodity->commodity)? $commodity->commodity->sku:'';
-                                $list[$cell]['s_commodity_name'] = isset($commodity->commodity)?$commodity->commodity->name :'';
+                            foreach ($commodities as $commodity) {
+                                $list[$cell]['s_commodity_code'] = isset($commodity->commodity) ? $commodity->commodity->sku : '';
+                                $list[$cell]['s_commodity_name'] = isset($commodity->commodity) ? $commodity->commodity->name : '';
                                 $list[$cell]['s_amount'] = $commodity->amount;
+                                $cell++;
                             }
                         }
-                        $cell++;
                     }
-                    $count = $cell - $i > $count ?  $cell - $i : $count;
+                    $count = $cell - $i > $count ? $cell - $i : $count;
                 }
             }
             if (isset($result->rejectedBill)) {
@@ -261,34 +259,23 @@ class OrderIssueController extends Controller
                     $list[$cell]['goods_amount'] = $value['amount'];
                     $list[$cell]['is_checked'] = $value['is_checked'];
                     $list[$cell]['remark'] = $value['remark'];
-                    $cell ++;
+                    $cell++;
                 }
-                $count = $cell - $i > $count ?  $cell - $i : $count;
+                $count = $cell - $i > $count ? $cell - $i : $count;
             }
             $i += $count;
-            $mergeCell[$sign] = $i+1;
+            $mergeCell[$sign] = $i + 1;
         }
         $columnName = [
-            "A", "B", "C", "D", "E", "F",
-            "G", "H", "I",
-            "J", "K", "L", "M",
-            /*"N", "O", "P",*/
-            /*"Q", "R", "S", "T", "U",*/
-            "V",
-            /*"W", "X", "Y",*/
-            "Z",
-            "AA", "AB", "AC",
-            /*"AD", "AF", "AG",*/
-            "AH", "AI", "AJ",
-            "AK", "AL" , "AM"];
-        if(Gate::has('客户不可见')){
+            "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", /* "O", "P","Q",*//* "R", "S", "T", "U", "V",*/
+            "W", /*"X", "Y",*/"Z", "AA", "AB", "AC", /*"AD", "AF", "AG",*/"AH", "AI", "AJ", "AK", "AL", "AM"];
+        if (Gate::has('客户不可见')) {
             unset($row[0]['baoshi_indemnity_money']);
             unset($columnName['AK']);
-
         }
-        foreach ($list as $key=>&$value){
-            foreach ($row[0] as $rowKey=>$rowValue){
-                if(!isset($value[$rowKey])){
+        foreach ($list as $key => &$value) {
+            foreach ($row[0] as $rowKey => $rowValue) {
+                if (!isset($value[$rowKey])) {
                     $value[$rowKey] = '';
                 }
             }
@@ -313,7 +300,7 @@ class OrderIssueController extends Controller
             return ['success' => false, 'fail_info' => '没有传入的订单编号'];
         }
         $orderIssueService = app('orderIssueService');
-        return $orderIssueService->orderIssueTag($request);
+        return $orderIssueService->orderIssueTag($request->all());
     }
 
     public function apiDestroy(Request $request)
@@ -339,23 +326,30 @@ class OrderIssueController extends Controller
         if (!Gate::allows('订单管理-问题件-编辑')) {
             return ['success' => false, 'fail_info' => '没有对应权限'];
         }
-        $validator =  $this->apiUpdateValidator($request);
-        if ($validator->fails()){
+        $validator = $this->apiUpdateValidator($request->input('orderIssues'));
+        if ($validator->fails()) {
             $arr = [];
-            foreach ($validator->getMessageBag()->toArray() as $k=>$error){
+            foreach ($validator->getMessageBag()->toArray() as $k => $error) {
                 array_push($arr, $error[0]);
             }
-            return [
-                'success' => false,
-                'errors' => $arr
-            ];
+            return ['success' => false, 'errors' => $arr];
         }
-        $orderIssue = OrderIssue::where('id', $request->input('id'))->first();
+        if($request->filled( 'rejectedBill')){
+            $validator = $this->apiUpdateValidatorRejectedBill($request->input('rejectedBill'));
+            if($validator->fails()){
+                $arr = [];
+                foreach ($validator->getMessageBag()->toArray() as $k => $error) {
+                    array_push($arr, $error[0]);
+                }
+                return ['success' => false, 'errors' => $arr];
+            }
+        }
+        $orderIssue = OrderIssue::where('id', $request->input('orderIssues')['id'])->first();
         if (!$orderIssue) {
             return ['success' => false, 'fail_info' => '数据库没有相应记录,请到查询页面刷新重试'];
         }
-        $orderIssue->fill($request->all());
-        $orderIssue->update();
+        $orderIssueService = app('orderIssueService');
+        $orderIssueService->updateOrderIssue($orderIssue, $request->all());
         $this->log(__METHOD__, __FUNCTION__, json_encode($request->toArray()), Auth::user()['id']);
         return ['success' => true, 'id' => $orderIssue['id']];
     }
@@ -368,11 +362,11 @@ class OrderIssueController extends Controller
         if (!$request->has('ids')) {
             return ['success' => false, 'fail_info' => '没有传入对应的参数'];
         }
-        $count = OrderIssue::whereIn('id', $request->input('ids'))->where('handle_status', 2)->count();
+        $count = OrderIssue::whereIn('id', $request->input('ids'))->where('final_status', '已解决')->count();
         if ($count > 0) {
             return ['success' => false, 'fail_info' => '勾选的内容中已有完结的订单问题件,取消勾选后重试'];
         } else {
-            $count = OrderIssue::whereIn('id', $request->input('ids'))->update(['handle_status' => 2]);
+            OrderIssue::whereIn('id', $request->input('ids'))->update(['final_status' => '已解决']);
             foreach ($request->input('ids') as $id) {
                 OrderIssueProcessLog::create(['order_issue_id' => $id, 'user_id' => Auth::user()['id'], 'type' => '结束', 'content' => '完结订单']);
             }
@@ -391,72 +385,89 @@ class OrderIssueController extends Controller
         }
         $bool = OrderIssue::where('id', $request->input('id'))->update(['is_new_rejecting' => '已处理']);
         if ($bool) {
-            OrderIssueProcessLog::create(['order_issue_id' => $request->input('id'), 'user_id' => Auth::user()['id'], 'content' => '订单已处理', 'type' => '处理']);
-            return ['success' => true];
+            $log = OrderIssueProcessLog::create(['order_issue_id' => $request->input('id'), 'user_id' => Auth::user()['id'], 'content' => '订单已处理', 'type' => '处理']);
+            $log=OrderIssueProcessLog::with(['user'])->where('id',$log['id'])->first();
+            return ['success' => true,'data'=> $log];
         }
         return ['success' => false, 'fail_info' => '修改失败'];
     }
 
-    public function apiGetOrderInfoByWMSOrderNo(Request $request)
+    public function apiGetOrderInfoByClientNo(Request $request)
     {
-        if (!$request->filled('WMSOrderNo')) {
-            return ['success' => false, 'fail_info' => '缺失WMS订单参数无法查询'];
+        if (!$request->filled('clientNo')) {
+            return ['success' => false, 'fail_info' => '缺失WMS订单参数无法查询'];
         }
         $orderService = app('orderService');
-        $orderInfo = $orderService->createOrderByWMSOrderNo($request->input('WMSOrderNo'));
+        $orderInfo = $orderService->findOrCreateByClientCode($request->input('clientNo'));
         if (!$orderInfo) {
-            return ['success' => false, 'fina_info' => '没有对应的WMS订单号'];
+            return ['success' => false, 'fail_info' => '没有对应的WMS订单信息'];
         }
         return ['success' => true, 'data' => $orderInfo];
     }
 
-    public function apiOrderIssueHasCreate(Request $request)
+    public function apiOrderIssueHasClientCode(Request $request)
     {
-        if (!$request->filled(['type', 'id'])) {
+        if (!$request->filled('clientCode')) {
             return ['success' => false, 'fail_info' => '缺少对应的参数或条件'];
         }
         $orderService = app('orderService');
-        $rejectedService = app('rejectedService');
-        if ($request->input('type') == 'WMSOrderNo') {
-            $order = $orderService->createOrderByWMSOrderNo($request->input('id'));
-            $bool = OrderIssue::where('order_id', $order['id'])->count() > 0;
-            if ($bool) {
-                return ['success' => false, 'fail_info' => '该订单号已有问题订单件'];
-            } else {
-                $order = $orderService->createOrderByWMSOrderNo($request->input('id'));
-                $rejectedBill = $rejectedService->getRejectedByWMSOrderNo($request->input('id'));
-                return ['success' => true, 'data' => compact(['order', 'rejectedBill'])];
+        $clientCode = $request->input('clientCode');
+        $order = Order::where('client_code', $clientCode)->first();
+        if ($order) {
+            if (OrderIssue::where('order_id', $order['id'])->count()) {
+                return ['success' => false, 'fail_info' => '该客户订单号已有对应的订单问题件'];
             }
-        } else if ($request->input('type') == 'RejectedBill') {
-            $rejectedBill = RejectedBill::where('logistic_number_return',$request->input('id'))->first();
-            if(!$rejectedBill){
-                return  ['success' => false, 'fail_info' => '没有对应的问题单号'];
+            $order = $orderService->findOrCreateByClientCode($clientCode);
+            return ['success' => true, 'order' => $order];
+        } else {
+            $orderHeader = OracleDOCOrderHeader::where('SOReference1', $clientCode)->first();
+            if (!$orderHeader) {
+                return ['success' => false, 'fail_info' => '该客户订单号没有对应的订单信息'];
+            } else {
+                $order = $orderService->findOrCreateByClientCode($clientCode);
+                $rejectedBill = $orderService->getRejectedBillOfClientCode($clientCode);
+                return ['success' => true, 'order' => $order, 'rejectedBill' => $rejectedBill];
             }
-            $bool = OrderIssue::where('rejected_bill_id',$rejectedBill['id'] )->count() > 0;
-            if ($bool) {
-                return ['success' => false, 'fail_info' => '退回单号已有对应的问题单'];
+        }
+    }
+
+    public function apiOrderIssueHasLogisticNumberReturn(Request $request)
+    {
+        if (!$request->filled('logisticNumberReturn')) {
+            return ['success' => false, 'fail_info' => '缺少对应的参数或条件'];
+        }
+        $logisticNumberReturn = $request->input('logisticNumberReturn');
+        $rejectedBill = RejectedBill::with('items')->where('logistic_number_return', $logisticNumberReturn)->first();
+        if ($rejectedBill) {
+            $orderIssue = OrderIssue::where('rejected_bill_id', $rejectedBill->id)->first();
+
+            if ($orderIssue) {
+                return ['success' => false, 'fail_info' => '该退回单号已有对应的问题件'];
             } else {
-                $order = $orderService->getOrderInfoByLogisticNumberReturn($request->input('id'));
-                $rejectedBill = RejectedBill::with('items')->where('logistic_number_return', $request->input('id'))->first();
-                return ['success' => true, 'data' => compact(['order', 'rejectedBill'])];
+                $orderService = app('orderService');
+                $order = $orderService->findOrCreteByLogisticNumberReturn($logisticNumberReturn);
+                return ['success' => true, 'order' => $order, 'rejectedBill' => $rejectedBill];
             }
+        } else {
+            return ['success' => true, 'meg' => '没有对应的退回单号,但仍可以录入'];
         }
     }
 
-    public function apiUpdateValidator(Request $request){
-        return Validator::make($request->input(), [
+    public function apiUpdateValidator(array $arr)
+    {
+        return Validator::make($arr, [
             'order_issue_type_id' => ['required'],
             'handle_status' => ['nullable'],
             'result_explain' => ['nullable'],
-            'logistic_indemnity_money' => ['nullable','numeric'],
+            'logistic_indemnity_money' => ['nullable', 'numeric'],
             'logistic_express_remission' => ['nullable'],
-            'baoshi_indemnity_money' => ['nullable','numeric'],
+            'baoshi_indemnity_money' => ['nullable', 'numeric'],
             'baoshi_express_remission' => ['nullable'],
-        ],[
-            'required' => [':attribute 为必填项',':attribute'] ,
-            'numeric' => [':attribute  为可确认的数值',':attribute']
-        ],[
-            'order_issue_type_id'=>'问题类别',
+        ], [
+            'required' => [':attribute 为必填项', ':attribute'],
+            'numeric' => [':attribute  为可确认的数值', ':attribute']
+        ], [
+            'order_issue_type_id' => '问题类别',
             'handle_status' => '处理状态',
             'result_explain' => '处理结果说明',
             'logistic_indemnity_money' => '承运商赔偿金额',
@@ -465,4 +476,18 @@ class OrderIssueController extends Controller
             'baoshi_express_remission' => '宝时快递减免',
         ]);
     }
+
+    public function apiUpdateValidatorRejectedBill(array $arr){
+        return Validator::make($arr, [
+            'logistic_number_return'=>['required'],
+            'id_owner'=>['required'],
+            'id_logistic_return'=>['required'],
+        ], [
+            'required' => [':attribute 为必填项', ':attribute'],
+        ], [
+            'logistic_number_return'=> '退回单号',
+            'id_owner'=> '退回单号货主',
+            'id_logistic_return'=> '退回单号承运商',
+        ]);
+    }
 }

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

@@ -69,7 +69,7 @@ class OrderIssueProcessLogController extends Controller
         }
     }
 
-    public function apisDestroy(Request $request){
+    public function apiDestroy(Request $request){
         if(!$request->filled('id')){
             return ['success'=>false,'fail_info'=>'没有传入对应参数'];
         }

+ 0 - 2
app/Http/Controllers/RejectedBillItemController.php

@@ -72,10 +72,8 @@ class RejectedBillItemController extends Controller
             $rejectedBillItem->save();
         }
         $rejectedBillItem->injectCommodityName();
-
         $rejectedBIll = RejectedBill::where('id',$request->input('id_rejected_bill'))->first();
         $rejectedBIll->syncOrderIssue();
-
         $this->log(__METHOD__,__FUNCTION__,json_encode($request->toArray()),Auth::user()['id']);
         return ['success'=>'true','id'=>$rejectedBillItem['id']];
     }

+ 4 - 4
app/Http/Controllers/RejectedController.php

@@ -514,10 +514,10 @@ class RejectedController extends Controller
         if(!$request->filled('logisticNumberReturn')){
             return ['success' => false,'fail_info' => '没有传入对应的参数'];
         }
-        $data =  RejectedBill::with(['items'])->where('logistic_number_return',$request->input('logisticNumberReturn'));
-        if(!$data){
-            return ['success' => false,'fail_info' => '没有对应的退回单'];
+        $rejectedBill =  RejectedBill::with(['items'])->where('logistic_number_return',$request->input('logisticNumberReturn'))->first();
+        if(!$rejectedBill){
+            return ['success' => true,'msg' => '没有对应的退回单号,但仍可以生成问题订单'];
         }
-        return ['success'=>true,'data' => $data];
+        return ['success'=>true,'rejectedBill' => $rejectedBill];
     }
 }

+ 12 - 2
app/Http/Controllers/RoleController.php

@@ -18,10 +18,20 @@ class RoleController extends Controller
      *
      * @return Response
      */
-    public function index()
+    public function index(Request $request)
     {
         if(!Gate::allows('角色-查询')){ return redirect(url('/'));  }
-        $roles=Role::with('authorities')->orderBy('id','desc')->paginate(35);
+        $query = Role::with('authorities');
+/*        if($request->has('user')){
+            $user = $request->input('user');
+            $query->whereHas('users',function($query) use ($user){
+                $query->where('name','like',$user);
+            });
+        }*/
+        if($request->has('role')){
+            $query->where('name','like',$request->input('role'));
+        }
+        $roles= $query->orderBy('id','desc')->paginate(35);
         return view('maintenance.role.index',['roles'=>$roles]);
     }
 

+ 13 - 2
app/Http/Controllers/UserController.php

@@ -22,10 +22,21 @@ class UserController extends Controller
      *
      * @return Response
      */
-    public function index()
+    public function index(Request $request)
     {
         if(!Gate::allows('用户-查询')){ return redirect(url('/'));  }
-        $users=User::with(['roles','carriers','userWorkgroups'])->orderBy('id','desc')->paginate(35);
+        $query = User::with(['roles','carriers','userWorkgroups']);
+        if($request->has('user')){
+           $query->where('name','like',$request->input('user'));
+        }
+        if($request->has('role')){
+            $role = $request->input('role');
+            $query->whereHas('roles',function($query) use ($role){
+                 $query->where('name','like',$role);
+            });
+        }
+//        $users=User::with(['roles','carriers','userWorkgroups'])->orderBy('id','desc')->paginate(35);
+        $users = $query->orderBy('id','desc')->paginate(35);
         $users->each(function (User $user){
             $user['isSuperAdmin']=$user->isSuperAdmin();
         });

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

@@ -25,7 +25,7 @@ class UserLaborController extends Controller
      */
     public function index()
     {
-        $userLabors=UserLabor::with('userDetail')->paginate(50);
+        $userLabors=UserLabor::with('userDetail')->orderBy('user_id','desc')->paginate(50);
 
         foreach ($userLabors as $userLabor){
             if($userLabor->userDetail){

+ 1 - 0
app/Http/Controllers/WaveController.php

@@ -78,6 +78,7 @@ class WaveController extends Controller
         $waveService = app("WaveService");
         $meg = ['success'=>false];
         $ids = $request->input("ids");
+        /** @var WaveService $waveService */
         $meg = $waveService->cancelPrint($ids);
         if($meg['fail_info']){
             return $meg;

+ 36 - 41
app/Imports/OrderIssueImport.php

@@ -7,6 +7,8 @@ use App\Order;
 use App\OrderIssue;
 use App\OrderIssueProcessLog;
 use App\OrderIssueType;
+use App\Services\OrderService;
+use App\Services\RejectedService;
 use Doctrine\DBAL\Connection;
 use Illuminate\Support\Collection;
 use Illuminate\Support\Facades\Auth;
@@ -18,70 +20,62 @@ use Maatwebsite\Excel\Imports\HeadingRowFormatter;
 
 HeadingRowFormatter::default('none');
 
-class OrderIssueImport implements ToCollection, WithHeadingRow,WithMultipleSheets
+class OrderIssueImport implements ToCollection, WithHeadingRow, WithMultipleSheets
 {
 
     public function Collection(Collection $collection)
     {
         $endIS = false;
-        if (!isset($collection->toArray()[0]['原始运单号']) || !isset($collection->toArray()[0]['情况说明']) || !isset($collection->toArray()[0]['问题类别']))
+        if (!isset($collection->toArray()[0]['原始运单号']) || !isset($collection->toArray()[0]['情况说明']) || !isset($collection->toArray()[0]['问题类别'])) {
             Cache::put('error', '请检查您第一行标题是否存在原始运单号,情况说明,问题类别');
-        else $endIS = true;
+        } else {
+            $endIS = true;
+        }
         $exception = [];
         $sum = 2;
         $orderService = app('orderService');
-        $orderIssueService = app('orderIssueService');
-        $orderIssues = [];
+        $rejectedService = new RejectedService();
         if ($endIS) {
             foreach ($collection as $row) {
-
+                $client_no = trim($row['原始运单号'], ' ');
                 if (!$row['原始运单号']) {
                     array_push($exception, ['第' . $sum . '行数据运单号为空!']);
                     $sum++;
                     continue;
-                }
-                if (!$row['情况说明']) {
+                } else if (!$row['情况说明']) {
                     array_push($exception, ['第' . $sum . '行问题说明为空!']);
                     $sum++;
                     continue;
-                }
-                if (!$row['问题类别']) {
+                } else if (!$row['问题类别']) {
                     array_push($exception, ['第' . $sum . '行问题类别为空!']);
                     $sum++;
                     continue;
                 }
-                if(OracleDOCOrderHeader::where('orderNo',$row['原始运单号'])->count() == 0){
-                    array_push($exception, ['订单' . $row['原始运单号'] . '运单号不存在']);
+                $count = OracleDOCOrderHeader::where('SOReference1', $client_no)->count();
+                if (!$count) {
+                    array_push($exception, ['原始运单号' . $row['原始运单号'] . '对应的WMS运单不存在']);
+                    $sum++;
                     continue;
                 }
-                $order = Order::with('issue')->where('code', $row['原始运单号'])->first();
-
-                $orderHeader =OracleDOCOrderHeader::where('orderNo',$row['原始运单号'])->first();
-                if (!$row['问题类别']) {
-                    array_push($exception, ['订单' . $row['原始运单号'] . '没有对应的问题类别']);
-                } else if (!$orderHeader) {
-                    array_push($exception, ['订单' . $row['原始运单号'] . '对应的WMS运单不存在']);
-                } else if (isset($order->issue) ) {
-                    array_push($exception, ['订单' . $row['原始运单号'] . '对应的问题件已存在']);
+                $order = $orderService->findOrCreateByClientCode($client_no);
+                $orderIssue = OrderIssue::where('order_id', $order['id'])->first();
+                $rejectedBill = $rejectedService->getRejectedByClientNo($client_no);
+                if ($orderIssue) {
+                    array_push($exception, ['原始运单号' . $row['原始运单号'] . '对应的问题件已存在']);
+                    $sum++;
+                    continue;
+                }
+                $arr = ['order_id' => $order['id'],];
+//                $arr['result_explain'] = $row['情况说明'];
+                if ($rejectedBill) {
+                    $arr['rejected_bill_id'] = $rejectedBill['id'];
+                }
+                $orderIssue = OrderIssue::create($arr);
+                if ($orderIssue) {
+                    array_push($exception, ['订单' . $row['原始运单号'] . '问题件创建成功!']);
+                    OrderIssueProcessLog::create(['order_issue_id' => $orderIssue['id'], 'user_id' => Auth::user()['id'], 'content' => $row['情况说明'], 'type' => '创建']);
                 } else {
-                    $type = OrderIssueType::where('name',$row['问题类别'])->first();
-                    if ($type == null) {
-                        array_push($exception, ['订单' . $row['原始运单号'] . '没有对应的问题类别']);
-                        continue;
-                    }
-                    $order = $orderService->createOrderByWMSOrderNo($row['原始运单号']);
-                    if (!$order) {
-
-                        $orderIssue = $orderIssueService->createOrFind($row['原始运单号']);
-                        $orderIssue->order_issue_type_id = $type->id;
-                        $orderIssue->save();
-
-                        if (!$orderIssue) {
-                            array_push($exception, ['订单' . $row['原始运单号'] . '问题件创建失败']);
-                        }
-                        OrderIssueProcessLog::create(['order_issue_id'=>$orderIssue['id'],'user_id'=>Auth::user()['id'],'content'=>'创建订单问题件','type'=>'创建']);
-                        array_push($orderIssues, $orderIssue);
-                    }
+                    array_push($exception, ['订单' . $row['原始运单号'] . '问题件创建失败']);
                 }
                 $sum++;
             }
@@ -94,7 +88,8 @@ class OrderIssueImport implements ToCollection, WithHeadingRow,WithMultipleSheet
      * ExcelImprot 默认是有多少个分表就执行多少次的分表
      * @return OrderIssueImport[]|array
      */
-    public function sheets():array{
-        return [0=>new OrderIssueImport()];
+    public function sheets(): array
+    {
+        return [0 => new OrderIssueImport()];
     }
 }

+ 0 - 30
app/Inventory.php

@@ -1,30 +0,0 @@
-<?php
-
-namespace App;
-
-use App\Traits\ModelTimeFormat;
-use Illuminate\Database\Eloquent\Model;
-use Illuminate\Database\Eloquent\SoftDeletes;
-
-class Inventory extends Model
-{
-    use ModelTimeFormat;
-    use SoftDeletes;
-    protected $fillable=[
-        'id','owner_id','owner_id','type', 'start_at', 'end_at','total','processed','difference','returned','deleted_at','created_at',
-    ];
-    protected $appends = [
-            'surplus'
-    ];
-    public function owner(){
-        return $this->belongsTo('App\Owner','owner_id','id');
-    }
-    public function inventoryMissions(){
-        return $this->belongsTo('App\InventoryMission','id','inventory_id');
-    }
-
-    public function getSurplusAttribute()
-    {
-        return $this['total'] ? $this['total']-$this['processed']:null;
-    }
-}

+ 46 - 0
app/InventoryAccount.php

@@ -0,0 +1,46 @@
+<?php
+
+namespace App;
+
+use App\Traits\ModelTimeFormat;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Database\Eloquent\SoftDeletes;
+
+class InventoryAccount extends Model
+{
+    use ModelTimeFormat;
+    use SoftDeletes;
+    protected $fillable=[
+        'id','owner_id','type', 'start_at', 'end_at','total','processed','difference','returned','deleted_at','created_at',
+    ];
+    protected $appends = [
+            'surplus','check_surplus'
+    ];
+    public function owner(){
+        return $this->belongsTo('App\Owner','owner_id','id');
+    }
+    public function inventoryMissions(){
+        return $this->belongsTo('App\InventoryAccountMission','id','inventory_account_id');
+    }
+
+    public function getSurplusAttribute()
+    {
+        return $this['total'] ? $this['total']-$this['processed']:0;
+    }
+    public function getProcessedAmount(){
+        return $this->inventoryMissions()->where('checked','是')->where('inventory_account_id',$this['id'])->count();
+    }
+    //复盘剩余数
+    public function getCheckSurplusAttribute()
+    {
+        $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_account_id',$this['id'])->where('difference_amount','>',0)->count();
+    }
+    public function getReturnedAmount(){
+        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');
+    }
+}

+ 1 - 1
app/OperatorLog.php

@@ -24,6 +24,6 @@ class OperatorLog extends Model
     }
     public function getUserNameAttribute()
     {
-        return $this['user'] ? $this['user']['name'] : null;
+        return $this['user']['name'] ??'';
     }
 }

+ 2 - 2
app/OracleDOCOrderHeader.php

@@ -37,10 +37,10 @@ class OracleDOCOrderHeader extends Model
     }
 
     public function getOracleBASCustomerDescrCAttribute(){
-        return $this['oracleBASCustomer']? $this['oracleBASCustomer']['descr_c']:null;
+        return $this['oracleBASCustomer']['descr_c']??'';
     }
     public function getOracleBASCodeCodenameCAttribute(){
-        return $this['oracleBASCode'] ? $this['oracleBASCode']['codename_c'] : null;
+        return $this['oracleBASCode']['codename_c'] ??'';
     }
     public function hasUn(){
         return $this->hasMany('App\OracleDOCOrderDetail','orderno','orderno');

+ 51 - 39
app/Order.php

@@ -11,68 +11,64 @@ class Order extends Model
     use ModelTimeFormat;
 
     protected $fillable = [
-        'created_at','code','shop_id','owner_id',
-        'logistic_id','consignee_name','consignee_phone','province',
-        'city','district','address','wms_status'];
+        'created_at', 'code', 'shop_id', 'owner_id', 'client_code',
+        'logistic_id', 'consignee_name', 'consignee_phone', 'province',
+        'city', 'district', 'address', 'wms_status'];
 
     protected $appends = [
-        'creator',
         'logisticNumbers',
         'amount',
+        'commodityPackages'
     ];
 
-    public function logistic(){
-        return $this->belongsTo('App\Logistic','logistic_id','id');
+    public function logistic()
+    {
+        return $this->belongsTo('App\Logistic', 'logistic_id', 'id');
     }
 
-    public function issue(){
-        return $this->hasOne('App\OrderIssue','id','order_id');
+    public function issue()
+    {
+        return $this->hasOne('App\OrderIssue', 'id', 'order_id');
     }
 
-    public function shop(){
-        return $this->belongsTo('App\Shop','shop_id','id');
+    public function shop()
+    {
+        return $this->belongsTo('App\Shop', 'shop_id', 'id');
     }
 
-    public function owner(){
-        return $this->belongsTo('App\Owner','owner_id','id');
+    public function owner()
+    {
+        return $this->belongsTo('App\Owner', 'owner_id', 'id');
     }
 
-    public function packages(){
-        return $this->hasMany('App\OrderPackage','order_id','id');
+    public function packages()
+    {
+        return $this->hasMany('App\OrderPackage', 'order_id', 'id');
     }
 
-    public function setCreatorAttribute ($id,$user_id){
-        Sign::updateOrCreate(['signable_type'=>'orders','signable_id'=>$id,'field'=>'creator','mark'=>$user_id]);
-    }
-
-    public function getCreatorAttribute(){
-       return  $this->hasOne('App\Sign','signable_id','id')
-            ->where('signable_type','orders')
-            ->where('field','creator')
-            ->value('mark');
-    }
-
-    public function getlogisticNumbersAttribute(){
-        $packages = $this->packages();
-        if(!$packages){
+    public function getLogisticNumbersAttribute()
+    {
+        $packages = $this->packages;
+        if (!$packages) {
             return [];
-        }else{
+        } else {
             $arr = [];
-           foreach ( $packages->get() as $package){
-               $arr[] = $package->logistic_number;
-           }
-           return $arr;
+            foreach ($packages as $package) {
+                array_push($arr, $package->logistic_number);
+            }
+            return $arr;
         }
     }
 
-    public function getAmountAttribute(){
-        $packages = $this->packages();
-        if(!$packages){
+    public function getAmountAttribute()
+    {
+        $packages = $this->packages;
+        if (!$packages) {
             return 0;
-        }else{
+        } else {
             $count = 0;
-            foreach ( $packages->get() as $package){
-                foreach ($package->commodities as $item){
+            foreach ($packages as $package) {
+                foreach ($package->commodities as $item) {
                     $count += $item->amount;
                 }
             }
@@ -80,4 +76,20 @@ class Order extends Model
         }
     }
 
+    public function getCommodityPackagesAttribute()
+    {
+        $packages = $this->packages;
+        if (!$packages) {
+            return 0;
+        } else {
+            $count = 0;
+            foreach ($packages as $package) {
+                foreach ($package->commodities as $item) {
+                    $count++;
+                }
+            }
+            return $count;
+        }
+    }
+
 }

+ 2 - 3
app/OrderIssue.php

@@ -11,7 +11,7 @@ class OrderIssue extends Model
     use ModelTimeFormat;
 
     protected $fillable = [
-        'order_id','handle_status','create_at','rejected_bill_id','rejecting_status','result_explain',
+        'order_id','create_at','rejected_bill_id','rejecting_status','result_explain',
         'situation_explain', 'order_issue_type_id','second_order_id','is_new_rejecting',
         'final_status','logistic_indemnity_money','logistic_express_remission','baoshi_indemnity_money','baoshi_express_remission','user_workgroup_id'];
 
@@ -48,7 +48,6 @@ class OrderIssue extends Model
     }
 
     public function getSecondLogisticNumberAttribute(){
-        return $this['secondOrder'] ? $this['secondOrder']['code'] : null;
+        return $this['secondOrder']['code'] ??'';
     }
-
 }

+ 1 - 2
app/OrderIssueOnTop.php

@@ -9,11 +9,10 @@ class OrderIssueOnTop extends Model
 {
     //
     use ModelTimeFormat;
-
+    
     protected $fillable = [ 'order_issue_id','remark'];
 
     public function OrderIssue(){
         return $this->belongsTo('App\OrderIssue','order_issue_id','id');
     }
-
 }

+ 0 - 1
app/OrderPackage.php

@@ -12,7 +12,6 @@ class OrderPackage extends Model
 
     protected $fillable = ['order_id','logistic_number'];
 
-
     public function order(){
         return $this->belongsTo('App\Order','order_id','id');
     }

+ 18 - 13
app/RejectedBill.php

@@ -66,8 +66,10 @@ class RejectedBill extends Model
         $this['checked_numbers']=$initials.Carbon::now()->format('Ymd').$owner->getIncreasedCheckingCount();
         return $this['checked_numbers'];
     }
-    function orderIssue(){
-        return $this->hasOne('App\OrderIssue','rejected_bill_id','id');
+
+    function orderIssue()
+    {
+        return $this->hasOne('App\OrderIssue', 'rejected_bill_id', 'id');
     }
 
     function update(array $attributes = [], array $options = [])
@@ -138,11 +140,14 @@ class RejectedBill extends Model
         return $this['is_loaded'];
     }
 
-    public function syncOrderIssue(){
+    public function syncOrderIssue()
+    {
         $orderIssue = $this->orderIssue()->first();
-        if(isset($orderIssue)){
-           $this-> judgeRejectingStatus($orderIssue);
-           OrderIssue::where('id',$orderIssue['id'])->update(['is_new_rejecting'=>'有']);
+        if ($orderIssue ?? false) {
+            $this->judgeRejectingStatus($orderIssue);
+            OrderIssue::where('id', $orderIssue['id'])->update(['is_new_rejecting' => '有']);
+        } else {
+            OrderIssue::where('rejected_bill_id', $this->id)->update(['is_new_rejecting' => '有']);
         }
     }
 
@@ -151,13 +156,13 @@ class RejectedBill extends Model
         $orderPackageCommoditiesService = new OrderPackageCommoditiesService();
         $rejectedItems = [];
         $orderItems = [];
-        if ($orderIssue->rejected_bill_id) {
-            $rejectedBill = RejectedBill::find($orderIssue->rejected_bill_id)->first();
-            $rejectedBillItems = RejectedBillItem::where('id_rejected_bill', $rejectedBill->id)->get();
+        if ($orderIssue['rejected_bill_id'] ?? false) {
+            $rejectedBill = RejectedBill::find($orderIssue['rejected_bill_id'])->first();
+            $rejectedBillItems = RejectedBillItem::where('id_rejected_bill', $rejectedBill['id'])->get();
             if ($rejectedBillItems) {
                 foreach ($rejectedBillItems as $item) {
-                    if(!isset($rejectedItems[$item->barcode_goods])){
-                        $rejectedItems[$item->barcode_goods]  =0;
+                    if (!isset($rejectedItems[$item->barcode_goods])) {
+                        $rejectedItems[$item->barcode_goods] = 0;
                     }
                     $rejectedItems[$item->barcode_goods] = $item->amount + $rejectedItems[$item->barcode_goods] ?? 0;
                 }
@@ -167,12 +172,12 @@ class RejectedBill extends Model
             $orderIssue->save();
             return;
         }
-        if ($orderIssue->order_id) {
+        if ($orderIssue['order_id'] ?? false) {
             $orderPackageCommodities = $orderPackageCommoditiesService->getOrderPackageCommoditiesByOrderId($orderIssue->order_id);
             if ($orderPackageCommodities) {
                 foreach ($orderPackageCommodities as $key => $item) {
                     if (!isset($orderItems[$item->commodity->sku])) {
-                        Arr::add($orderItems,$item->commodity->sku,0);
+                        Arr::add($orderItems, $item->commodity->sku, 0);
                     }
                     $orderItems[$item->commodity->sku] = $orderItems[$item->commodity->sku] ?? 0 + $item->amount;
                 }

+ 4 - 2
app/RejectedBillItem.php

@@ -23,6 +23,9 @@ class RejectedBillItem extends Model
     public function rejectedBill(){
         return $this->belongsTo('App\RejectedBill', 'id_rejected_bill', 'id');
     }
+    public function quality(){
+        return $this->belongsTo(QualityLabel::class, 'id_quality_label', 'id');
+    }
     public function wmsReflectSku(){
         $bill=$this->rejectedBill()->first();
         $wmsReflectReceive=$bill->wmsReflectReceive()->first();
@@ -58,7 +61,6 @@ class RejectedBillItem extends Model
         }
     }
     public function getQualityLabelAttribute(){
-        $label=QualityLabel::find($this['id_quality_label']);
-        return $label['name'];
+        return $this['quality']['name'];
     }
 }

+ 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);
+    }
+
+}

+ 237 - 0
app/Services/InventoryAccountService.php

@@ -0,0 +1,237 @@
+<?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)->queryCondition($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->占用数量,
+            ];
+            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;
+    }
+}

+ 34 - 0
app/Services/InventoryService.php

@@ -6,6 +6,8 @@ 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;
@@ -192,5 +194,37 @@ class InventoryService
         return $inventory;
     }
 
+    //库存体积条件
+    function conditionQueryDailyLog(array $param){
+        $inventoryDailyLogs = InventoryDailyLog::query()->with(['owner','commodity'=>function($query){
+            $query->with('barcodes');
+        }])->orderByDesc('id');
+        $columnQueryRules=[
+            'owner_id' => ['multi' => ','],
+            'created_at_start' => ['alias' => 'created_at' , 'startDate' => ' 00:00:00'],
+            'created_at_end' => ['alias' => 'created_at' , 'endDate' => ' 23:59:59'],
+        ];
+        $inventoryDailyLogs = app(QueryService::class)->query($param,$inventoryDailyLogs,$columnQueryRules);
+        return $inventoryDailyLogs;
 
+    }
+
+    //库存体积
+    public function getInventoryDailyLog(array $param){
+        return $this->conditionQueryDailyLog($param)->paginate($param['paginate'] ?? 50);
+    }
+
+    //获取开启监听记录货主
+    public function getInventoryDailyLoggingOwner($column = ['id','owner_id'], $status = "启用"){
+        if (!is_array($column)) {
+            $column = [$column];
+        }
+        return InventoryDailyLoggingOwner::query()->select($column)->where('status',$status)->get();
+    }
+
+    //录入监听记录货主
+    public function firstOrCreate($param,$column = null){
+        if ($column)return InventoryDailyLoggingOwner::query()->firstOrCreate($param,$column);
+        return InventoryDailyLoggingOwner::query()->firstOrCreate($param);
+    }
 }

+ 152 - 157
app/Services/OrderIssueService.php

@@ -2,19 +2,13 @@
 
 namespace App\Services;
 
-use App\OracleDOCASNDetail;
-use App\OracleDOCASNHeader;
-use App\OracleDOCOrderDetail;
 use App\OracleDOCOrderHeader;
 use App\OrderIssue;
-use App\OrderIssueOnTop;
 use App\OrderIssueProcessLog;
 use App\OrderPackage;
 use App\Order;
-use App\OrderPackageCommodities;
 use App\RejectedBill;
 use App\RejectedBillItem;
-use App\Sign;
 use Illuminate\Http\Request;
 use Illuminate\Support\Arr;
 use Illuminate\Support\Facades\Auth;
@@ -30,30 +24,34 @@ class OrderIssueService
         app()->bind("orderPackageCommoditiesService", OrderPackageCommoditiesService::class);
     }
 
-    public function getQuery($param)
+    public function getQuery(array $arr, array $condition = null)
     {
+        if (!isset($condition)) {
+            $condition = $arr;
+        }
         $user = Auth::user();
         $owner_ids = $user ? $user->getPermittingOwnerIdsAttribute() : [];
         $order_ids = [];
-        if ($param['owner_id'] ?? false) {
-            $owner_ids = explode(',', $param['owner_id']);
+        if ($condition['owner_id'] ?? false) {
+            $owner_ids = explode(',', $condition['owner_id']);
         }
-        $orders = Order::query()->select('id')->whereIn('owner_id', $owner_ids)->get();
+
+        $orders = Order::select('id')->whereIn('owner_id', $owner_ids)->get();
         foreach ($orders as $order) {
             array_push($order_ids, $order['id']);
         }
         $query = OrderIssue::with(['top', 'userWorkGroup', 'issueType', 'logs' => function ($query) {
-            return $query->with(['user'])->orderByDesc('created_at');
-        }, 'order' => function ($query) use ($order_ids) {
-            return $query->whereIn('id', $order_ids)->with(['shop', 'logistic', 'owner', 'packages' => function ($query) {
-                return $query->with(['commodities' => function ($query) {
+            $query->with(['user'])->orderByDesc('created_at');
+        }, 'order' => function ($query) {
+            $query->with(['shop', 'logistic', 'owner', 'packages' => function ($query) {
+                $query->with(['commodities' => function ($query) {
                     return $query->with('commodity');
                 }]);
             }]);
         }, 'rejectedBill' => function ($query) {
-            return $query->with(['items']);
+            $query->with(['items']);
         }, 'secondOrder' => function ($query) {
-            return $query->with(['shop', 'logistic', 'owner', 'packages' => function ($query) {
+            $query->with(['shop', 'logistic', 'owner', 'packages' => function ($query) {
                 return $query->with(['commodities' => function ($query) {
                     return $query->with('commodity');
                 }]);
@@ -63,7 +61,7 @@ class OrderIssueService
                 return $query->whereIn('id', $owner_ids);
             });
         });
-        // ->whereIn('order_id', $order_ids)
+
         $query->selectRaw('order_issues.* ,order_issue_on_tops.id top_id ,order_issue_on_tops.remark,order_issue_on_tops.updated_at top_update')
             ->leftJoin('order_issue_on_tops', 'order_issue_on_tops.order_issue_id', '=', 'order_issues.id')
             ->whereNull('order_issue_on_tops.deleted_at')
@@ -72,72 +70,138 @@ class OrderIssueService
         return $query;
     }
 
-    public function getConditionQuery(array  $param)
+    private function getOrderQuery(array $arr, $query)
+    {
+        $query->whereHas('order', function ($query) use ($arr) {
+            if ($arr['client_code'] ?? false) {
+                $query->where('client_code', $arr['client_code']);
+            }
+            if ($arr['consignee_name'] ?? false) {
+                $query->where('consignee_name', 'like', $arr['consignee_name']);
+            }
+            if ($arr['consignee_phone'] ?? false) {
+                $query->where('consignee_phone', 'like', $arr['consignee_phone']);
+            }
+            if ($arr['logistic_number'] ?? false) {
+                $logistic_number = $arr['logistic_number'];
+                $query->whereHas('packages', function ($query) use ($logistic_number) {
+                    $query->where('logistic_number', $logistic_number);
+                });
+            }
+        });
+        return $query;
+    }
+
+    public function getRejectedBillQuery(array $arr, $query)
+    {
+        if (($arr['id_quality_label'] ?? false) || ($arr['good_barcode'] ?? false) || ($arr['good_name'] ?? false)) {
+            $query->whereHas('rejectedBill', function ($query) use ($arr) {
+                $query->whereHas('items', function ($query) use ($arr) {
+                    if ($arr['id_quality_label'] ?? false) {
+                        $query->where('id_quality_label', $arr['id_quality_label']);
+                    }
+                    if ($arr['good_barcode'] ?? false) {
+                        $query->where('barcode_goods', $arr['good_barcode']);
+                    }
+                    if ($arr['good_name'] ?? false) {
+                        $query->where('name_goods', 'like', $arr['good_name']);
+                    }
+                });
+            });
+        }
+        return $query;
+    }
+
+    public function getConditionQuery(array $arr, array $condition = null)
     {
-        $query = $this->getQuery($param);
-        if ($param["created_at_start"] ?? false) {
-            $query->where('created_at', '>=', $param["created_at_start"] . " 00:00:00");
+        $query = $this->getQuery($arr, $condition);
+        $query = $this->getOrderQuery($condition ?? $arr, $query);
+        $query = $this->getRejectedBillQuery($condition ?? $arr, $query);
+
+        if (!isset($condition)) {
+            $condition = $arr;
         }
-        if ($param["created_at_end"] ?? false) {
-            $query->where('created_at', '<=', $param["created_at_end"] . " 23:59:59");
+        if (isset($condition['created_at_start'])) {
+            $query->where('created_at', '>=', $condition['created_at_start'] . " 00:00:00");
         }
-        if ($param["final_status"] ?? false) {
-            $query->where('final_status', $param["final_status"]);
+        if (isset($condition['created_at_end'])) {
+            $query->where('created_at', '<=', $condition['created_at_end'] . " 23:59:59");
         }
-        if ($param["handle_status"] ?? false) {
-            $query->where('handle_status', $param["handle_status"]);
+        if (isset($condition['final_status'])) {
+            $query->where('final_status', $condition['final_status']);
         }
-        if ($param["logistic_indemnity_money"] ?? false) {
-            $query->where('logistic_indemnity_money', $param["logistic_indemnity_money"]);
+        if (isset($condition['order_issue_type_id'])) {
+            $query->where('order_issue_type_id', $condition['order_issue_type_id']);
         }
-        if ($param["baoshi_express_remission"] ?? false) {
-            $query->where('baoshi_express_remission', $param["baoshi_express_remission"]);
+        if (!($condition['is_handle'] ?? false) && !($condition['final_status'] ?? false)) {
+            $query->where(function ($query){
+                $query->where('final_status','<>','已解决')->orWhereNull('final_status');
+            });
+        }
+        if (isset($condition['logistic_indemnity_money'])) {
+            $query->where('logistic_indemnity_money', $condition['logistic_indemnity_money']);
         }
-        if ($param["is_new_rejecting"] ?? false) {
-            $query->where('is_new_rejecting', $param["is_new_rejecting"]);
+        if (isset($condition['baoshi_indemnity_money'])) {
+            $query->where('baoshi_indemnity_money', $condition['baoshi_indemnity_money']);
         }
-        if ($param["order_issue_ids"] ?? false) {
-            $orderIssuesId = $param["order_issue_ids"];
+        if (isset($condition['order_issue_ids'])) {
+            $orderIssuesId = $condition['order_issue_ids'];
             if (is_string($orderIssuesId)) {
                 $orderIssuesId = explode(',', $orderIssuesId);
             }
             $query->whereIn('order_issues.id', $orderIssuesId);
         }
+
         return $query;
     }
 
-    public function paginate(Request $request)
+    public function paginate(array $arr)
     {
-        return $this->getConditionQuery($request->input())->paginate($request->input('paginate', 50));
+        return $this->getConditionQuery($arr)->paginate($arr['paginate'] ?? 50);
     }
 
-    public function orderIssueTag(Request $request)
+    public function orderIssueTag(array $arr)
     {
-        $orderNos = $request->input('orderNos');
+        $orderNos = $arr['orderNos'];
         $meg = ['success' => false];
-        if ($this->verifyOrderIssue($request)) {
+        if ($this->verifyOrderIssue($arr)) {
             $meg['fail_info'] = '传入订单编号中对应的订单问题已有生成';
             return $meg;
         }
         foreach ($orderNos as $orderNo) {
-            $orderIssue = $this->createOrFind($orderNo);
+            $orderIssue = $this->createOrFindByOrderNo($orderNo);
             OrderIssueProcessLog::create(['order_issue_id' => $orderIssue['id'], 'user_id' => Auth::user()['id'], 'content' => '标记创建订单问题件', 'type' => '创建']);
         }
         $meg['success'] = true;
         return $meg;
     }
 
-    public function createOrFind($orderNo)
+    public function createOrFindByOrderNo($orderNo)
+    {
+        $orderService = app('orderService');
+        $rejectedService = app('rejectedService');
+        $orderHeader = OracleDOCOrderHeader::where('orderNo', $orderNo)->first();
+        if (!$orderHeader) {
+            return null;
+        }
+        return $this->createOrFind($orderHeader['soreference1']);
+    }
+
+    public function createOrFind($clientCode)
     {
         $orderService = app('orderService');
         $rejectedService = app('rejectedService');
-        $order = $orderService->createOrderByWMSOrderNo($orderNo);
+        $orderHeader = OracleDOCOrderHeader::where('SOREFERENCE1', $clientCode)->first();
+        if (!$orderHeader) {
+            return null;
+        }
+        $order = $orderService->findOrCreateByClientCode($clientCode);
         $arr = [
-            'order_id' => $order->id,
+            'order_id' => $order['id'],
         ];
         $orderIssue = OrderIssue::create($arr);
-        if ($order->code) {
-            $rejectedBill = $rejectedService->getRejectedByWMSOrderNo($order->code);
+        if ($order->client_code) {
+            $rejectedBill = $rejectedService->getRejectedByClientNo($clientCode);
             if ($rejectedBill) {
                 $orderIssue->rejected_bill_id = $rejectedBill['id'];
                 $orderIssue->save();
@@ -148,22 +212,12 @@ class OrderIssueService
         return $orderIssue;
     }
 
-    /*    public function createOrderIssue(Request $request)
-        {
-            $orderService = app('orderService');
-            $this->validatorCreate($request)->validate();
-            $oracleOrderNo = $request->input('order_id');
-            $logistic_number = $request->input('logistic_number');
-            $order = $orderService->creted($oracleOrderNo);
-            $this->create($request);
-        }*/
-
     public function validatorCreate(Request $request)
     {
         return Validator::make($request->input(), [
             'rejected_bill_id' => ['nullable'],
             'order_id' => ['nullable'],
-            'owner_id'=>['required'],
+            'owner_id' => ['required'],
             'second_order_id' => ['nullable'],
             'logistic_id' => ['nullable'],
             'order_issue_type_id' => ['required'],
@@ -176,7 +230,7 @@ class OrderIssueService
             'unique' => ':attribute 已存在',
             'numeric' => ':attribute 为数组',
         ], [
-            'owner_id'=>'货主',
+            'owner_id' => '货主',
             'rejected_bill_id' => '退回单号',
             'order_id' => '订单ID',
             'second_order_id' => '退回订单id',
@@ -189,15 +243,15 @@ class OrderIssueService
         ]);
     }
 
-    public function create(Request $request)
+    public function create(array $arr)
     {
-        $orderIssue = OrderIssue::create($request->all());
-        if (!$request->has('order_id')) {
-            $order = Order::create($request->all());
+        $orderIssue = OrderIssue::create($arr);
+        if (!$arr['order_id']) {
+            $order = Order::create($arr);
             $orderIssue->order_id = $order['id'];
             $orderIssue->save();
         }
-        if (!$request->filled('rejected_bill_id')) {
+        if (!$arr['rejected_bill_id']) {
             $orderIssue->update(['rejecting_status' => '无']);
         } else {
             $this->judgeRejectingStatus($orderIssue);
@@ -290,20 +344,20 @@ class OrderIssueService
         }
     }
 
-    public function createByLogisticNumber(Request $request)
+    public function createByLogisticNumber(array $arr)
     {
         $orderService = app('orderService');
-        $order = Order::create($request->all());
-        $orderIssue = OrderIssue::create($request->all());
+        $order = Order::create($arr);
+        $orderIssue = OrderIssue::create($arr);
         $orderIssue->order_id = $order['id'];
-        OrderPackage::create(['order_id' => $order->id, 'logistic_number' => $request->input('logistic_number_return')]);
+        OrderPackage::create(['order_id' => $order->id, 'logistic_number' => $arr['logistic_number_return']]);
         $orderIssue->update();
         return $orderIssue;
     }
 
-    public function verifyOrderIssue(Request $request)
+    public function verifyOrderIssue(array $arr)
     {
-        $orderIds = $request->input('orderNos');
+        $orderIds = $arr['orderNos'];
         $orders = Order::whereIn('code', $orderIds)->get();
         if (count($orders) == 0) {
             return false;
@@ -316,110 +370,51 @@ class OrderIssueService
         return $count != 0;
     }
 
-    /*    public function verifyOracleOrderNo(Request $request)
-        {
-            $meg = ['success' => false];
-            $oracleOrderNo = $request->input('oracleOrderNo');
-            $type = $request->input('type');
-            $orderHeader = OracleDOCOrderHeader::where('OrderNo', trim($oracleOrderNo, "'"))->first();
-            if ($orderHeader == null) {
-                $meg['fail_info'] = '没有编号对应的订单信息';
-            } else {
-                if ($type == 'backExpressNumber') {
-
-                    $orderASNHeader = OracleDOCASNHeader::where('ASNReference2', $orderHeader->soreference1)->first();
-
-                    if ($orderASNHeader == null) {
-                        $meg['fail_info'] = '没有对应的退件信息';
-                    } else {
-                        $express_number = $orderASNHeader->asnreference3; // 快递单号
-                        $express_number == null ? $meg['fail_info'] = '没有对应的快递单号' : ($meg['success'] = true && $meg['expressNumber'] = $express_number);
-                    }
-                } else if ($type == 'verify') {
-                    if (!$orderHeader) {
-                        $mes['fail_info'] = '编号对应的订单信息不存在';
-                    } else {
-                        $mes['success'] = true;
-                    }
-                }
-            }
-            return $meg;
-        }*/
-
-    /*    public function verifyLogisticNumber(Request $request)
-        {
-            $logisticNumber = $request->input('logisticNumber');
-            $ASNHeader = OracleDOCASNHeader::where('ASNReference2', $logisticNumber)->first();
-            $orderHeader = OracleDOCOrderHeader::where('soreference1', $ASNHeader->asnreference3)->first();
-            $meg = ['success' => false];
-            if (!$orderHeader) {
-                $meg['fail_info'] = '快递单号没有对应的订单';
-            }
-            return $meg['success'] = true;
-        }*/
-
-//    public function getOrderHead(Request $request)
-//    {
-//        $data = ['orderHeader' => null, 'orderDetails' => null, 'rejectedBill' => null];
-//        $logisticNumberReturn = $request->input('logisticNumberReturn');
-//        $ASNOrderHeaders = OracleDOCASNHeader::where('ASNReference3', $logisticNumberReturn)->get();
-//        if (count($ASNOrderHeaders) == 0) {
-//            return $data;
-//        }
-//        $orderHeader = OracleDOCOrderHeader::where('SOReference1', $ASNOrderHeaders->asnreference3)->get();
-//        $data['orderHeader'] = $orderHeader;
-//        $orderDetails = OracleDOCASNDetail::with(['sku'])->where('OrderNo', $orderHeader)->get();
-//        $data['orderDetails'] = $orderDetails;
-//
-//        return $data;
-//    }
-
-    public function getReturnLogisticInfo(Request $request)
-    {
-        $logisticNumberReturn = $request->input('logisticNumberReturn');
-        $ASNOrderHeaders = OracleDOCASNHeader::where('ASNReference3', $logisticNumberReturn)->get();
-        $ASNNo = [];
-        foreach ($ASNOrderHeaders as $ASNOrderHeader) {
-            $ASNNo[] = $ASNOrderHeader->asnno;
-        }
-        return OracleDOCASNDetail::whereIn('asnno', $ASNNo)->get();
-    }
-
-    public function getOrderHeadByOrderNo(Request $request)
-    {
-        $orderNo = $request->input('orderNo');
-        $orderHeader = OracleDOCOrderHeader::where('orderNo', $orderNo)->get();
-        $orderDetails = OracleDOCOrderDetail::with(['sku'])->where('orderNo', $orderNo)->get();
-        return ['orderHeader' => $orderHeader, 'orderDetails' => $orderDetails];
-    }
-
     public function exportExcel(Request $request)
     {
         $result = null;
         if ($request->getMethod() == 'GET') {
-// 所有页
             if ($request->has('checkAllSign')) {
-                $result = $this->getConditionQuery($request)->get();
+                $result = $this->getConditionQuery($request->all(), null)->get();
             }
         } else if ($request->getMethod() == 'POST') {
-// 选中
             $orderIssueIds = $request->input('data');
             $ids = explode(',', $orderIssueIds);
-            $result = $this->getConditionQuery($request, ['order_issue_ids' => $ids])->get();
+            $request['order_issue_ids'] = $ids;
+
+            $result = $this->getConditionQuery($request->all(), null)->get();
         }
         return $result;
     }
 
-    public function paddingData(array $row, array $rowData)
+    public function updateOrderIssue(OrderIssue $orderIssue, array $arr)
     {
-        foreach ($rowData as $key => $value) {
-            foreach ($row as $rowKey) {
-                if (!isset($value[$rowKey])) {
-                    $value[$rowKey] = '';
-                }
+        if ($arr['rejectedBill'] ?? false) {
+            if ($arr['rejectedBill']['id'] ?? false) {
+                $rejectedBill = RejectedBill::where('id', $arr['rejectedBill']['id'])->first();
+                $rejectedBill->fill($arr['rejectedBill']);
+                $rejectedBill->update();
+                $rejectedBill->syncOrderIssue();
+                $request['orderIssues']['rejected_bill_id'] = $rejectedBill['id'];
+            } else if ($arr['rejectedBill']['id_logistic_return'] ?? false && $arr['rejectedBill']['logistic_number_return'] ?? false) {
+                $rejectedBill = RejectedBill::firstOrCreate([
+                        'id_logistic_return' => $arr['rejectedBill']['id_logistic_return'],
+                        'id_owner' => $arr['rejectedBill']['id_owner'],
+                        'logistic_number_return' => $arr['rejectedBill']['logistic_number_return'],]
+                );
+                $rejectedBill->save();
+                $rejectedBill->syncOrderIssue();
+                $request['orderIssues']['rejected_bill_id'] = $rejectedBill['id'];
+
             }
         }
-        return $rowData;
+        if ($arr['order'] ?? false) {
+            $order = Order::where('id', $arr['order']['id'])->first();
+            $order->fill($arr['order']);
+            $order->update();
+        }
+        $orderIssue->fill($arr['orderIssues']);
+        $orderIssue->update();
     }
 
 }

+ 50 - 17
app/Services/OrderPackageCommoditiesService.php

@@ -10,39 +10,72 @@ use App\Order;
 use App\OrderPackage;
 use App\OrderPackageCommodities;
 use App\Owner;
+use Illuminate\Support\Arr;
 
 class OrderPackageCommoditiesService
 {
-    public function createdOrderPackage(OrderPackage $orderPackage)
+    public function basedOnOracleDetailsStore($orderNo, $orderPackage)
+    {
+        $details = OracleDOCOrderDetail::where('orderNo', $orderNo)->get();
+        foreach ($details as $key => $detail) {
+            $this->createByOrderDetail($detail, $orderPackage);
+        }
+    }
+
+    public function basedOnActAllocationDetailsStoreByOrderNo($orderNo,$orderPackage){
+        $details = OracleActAllocationDetails::where('orderno', $orderNo)->get();
+        foreach ($details as $key => $detail) {
+            $this->createByActAllocationDetails($detail, $orderPackage);
+        }
+    }
+
+    public function basedOnActAllocationDetailsStore($orderPackage)
+    {
+        $details = OracleActAllocationDetails::where('picktotraceid', $orderPackage->logistic_number)->get();
+        foreach ($details as $key => $detail) {
+            $this->createByActAllocationDetails($detail, $orderPackage);
+        }
+    }
+
+    private function createByActAllocationDetails($detail, OrderPackage $orderPackage)
     {
-        $detail = OracleActAllocationDetails::where('picktotraceid',$orderPackage->logistic_number)->first();
         $owner = Owner::where(['code' => $detail->customerid])->first();      // 货主
         $sku = $detail->sku;
-        $owner_id = $owner->id;
+        $owner_id = $owner['id'];
         $commodity = Commodity::where(['sku' => $sku, 'owner_id' => $owner_id])->first();
         if ($commodity == null) {
             $basSku = OracleBasSKU::where(['sku' => $sku, 'customerid' => $detail->customerid])->first();
             $commodity = Commodity::create(['sku' => $sku, 'owner_id' => $owner_id, 'name' => $basSku->descr_c]);
         }
-        $arr = [
-            'order_package_id' => $orderPackage->id,      // 包裹id
-            'commodity_id' => $commodity->id,             // 商品id
-            'amount' => $detail->qty,                     // 商品数量
-        ];
-        $OrderPackageCommodities = OrderPackageCommodities::create($arr);
-        $OrderPackageCommodities->commodity = $commodity;
-        return $OrderPackageCommodities;
+        return OrderPackageCommodities::create(['order_package_id' => $orderPackage['id'], 'commodity_id' => $commodity['id'], 'amount' => $detail['qty']]);
     }
 
-    public function getOrderPackageCommoditiesByOrderId($orderId){
-        $order =  Order::where('id',$orderId)->first();
-        if(!$order){
+
+
+    public function getOrderPackageCommoditiesByOrderId($orderId)
+    {
+        $order = Order::where('id', $orderId)->first();
+        if (!$order) {
             return null;
         }
-        $orderPackageIds = OrderPackage::select('id')->where('order_id',$order['id'])->get();
-        if(!$orderPackageIds){
+        $orderPackageIds = OrderPackage::select('id')->where('order_id', $order['id'])->get();
+        if (!$orderPackageIds) {
             return null;
         }
-        return  OrderPackageCommodities::with('commodity')->whereIn('order_package_id',$orderPackageIds)->get();
+        return OrderPackageCommodities::with('commodity')->whereIn('order_package_id', $orderPackageIds)->get();
+    }
+
+    public function createByOrderDetail(OracleDOCOrderDetail $detail, OrderPackage $orderPackage)
+    {
+        $owner = Owner::where(['code' => $detail['customerid']])->first();      // 货主
+        $sku = $detail->sku;    // sku
+        $owner_id = $owner->id; // 货主id
+        $commodity = Commodity::where(['sku' => $sku, 'owner_id' => $owner_id])->first(); // 商品
+        if ($commodity == null) {
+            $basSku = OracleBasSKU::where(['sku' => $sku, 'customerid' => $detail->customerid])->first();   // 没有找到对应的商品信息
+            $commodity = Commodity::create(['sku' => $sku, 'owner_id' => $owner_id, 'name' => $basSku->descr_c]);
+        }
+       return  OrderPackageCommodities::create(['order_package_id' => $orderPackage['id'], 'commodity_id' => $commodity['id'], 'amount' => $detail['qtyordered']]);
     }
+
 }

+ 37 - 18
app/Services/OrderPackageService.php

@@ -16,30 +16,49 @@ class OrderPackageService
         app()->bind('orderPackageCommoditiesService', OrderPackageCommoditiesService::class);
     }
 
-    public function createdByOrder(Order $order, OracleDOCOrderHeader $orderHeader = null)
+    public function createdByOrder(Order $order)
     {
         $orderPackageCommoditiesService = app('orderPackageCommoditiesService');
-        if (!$orderHeader) {
-            $orderHeader = OracleDOCOrderHeader::where('OrderNo', trim($order->code, "'"))->first();
-        }
-// 获取orderNo 对应的打包详情
-        $orderActAllocationDetails = OracleActAllocationDetails::where(['OrderNo' => $order->code])->get();
-        if (!$orderActAllocationDetails) {
-            return [];
-        }
-        $orderPackages = [];
-        foreach ($orderActAllocationDetails as $detail){
-            $logistic_number = $detail->picktotraceid;
-            $orderPackage = OrderPackage::where(['logistic_number'=>$logistic_number])->first();
-            if(!$orderPackage){
-                $orderPackage = OrderPackage::firstOrCreate(['order_id'=>$order['id'],'logistic_number'=>$logistic_number]);
+        $actAllocationCount = OracleActAllocationDetails::where('OrderNo', $order['code'])->count();
+        $orderHeader = OracleDOCOrderHeader::where('OrderNo', $order['code'])->first();
+        $orderDetailCount = OracleDOCOrderDetail::where('OrderNo', $order['code'])->count();
+        $logistic_number = null;
+        if ($actAllocationCount == 0) {  // 通过oracle Order Detail
+            $logistic_number = $orderHeader['soreference5'];
+            if ($orderDetailCount == 0) {return null;}
+            if ($logistic_number == null || $logistic_number == '*') { return null; }
+            $orderPackage = OrderPackage::create(['order_id' => $order['id'], 'logistic_number' => $logistic_number]);
+            $orderPackageCommoditiesService->basedOnOracleDetailsStore($orderHeader['orderno'], $orderPackage);
+        } else if ($actAllocationCount > 0) {
+            $count = OracleActAllocationDetails::where('OrderNo', $order['code'])->whereNull('picktotraceid')->count();
+            if ($count > 0) {   // 快递单号为空
+                if (($orderHeader['soreference5'] ?? false) && $orderHeader['soreference5'] == '*') { return null; }
+                $logistic_number = $orderHeader['soreference5'];
+                $orderPackage = OrderPackage::create(['order_id' => $order['id'], 'logistic_number' => $logistic_number]);
+                $orderPackageCommoditiesService->basedOnOracleDetailsStore($order, $orderPackage);
+            } else {
+                $ActAllocationDetails = OracleActAllocationDetails::where('orderno', $order['code'])->get();
+                foreach ($ActAllocationDetails as $detail) {
+                    $logistic_number = $detail['picktotraceid'];
+                    if ($logistic_number == null || $logistic_number == '*') {
+                        $logistic_number = $orderHeader['soreference5'];
+                        if ($logistic_number == null || $logistic_number == '*')  return null;
+                        $orderPackage = OrderPackage::where(['order_id' => $order['id'], 'logistic_number' => $logistic_number])->first();
+                        if($orderPackage)continue;
+                        $orderPackage = OrderPackage::create(['order_id' => $order['id'], 'logistic_number' => $logistic_number]);
+                        $orderPackageCommoditiesService->basedOnActAllocationDetailsStoreByOrderNo($order['code'], $orderPackage);
+                        continue;
+                    }
+                    $orderPackage = OrderPackage::where(['order_id' => $order['id'], 'logistic_number' => $logistic_number])->first();
+                    if ($orderPackage) continue;
+                    $orderPackage = OrderPackage::create(['order_id' => $order['id'], 'logistic_number' => $logistic_number]);
+                    $orderPackageCommoditiesService->basedOnActAllocationDetailsStore($orderPackage);
+                }
             }
-            $orderPackageCommoditiesService->createdOrderPackage($orderPackage,$detail);
         }
-       $orderPackages =  OrderPackage::with(['commodities' => function($query){
+        return OrderPackage::with(['commodities' => function ($query) {
             return $query->with(['commodity']);
         }])->get();
-        return  $orderPackages;
     }
 
 }

+ 27 - 57
app/Services/OrderService.php

@@ -13,6 +13,7 @@ use App\OrderItems;
 use App\OrderPackage;
 use App\OrderPackageCommodities;
 use App\Owner;
+use App\RejectedBill;
 use App\Shop;
 
 class OrderService
@@ -22,11 +23,10 @@ class OrderService
         app()->bind("orderPackageService", OrderPackageService::class);
     }
 
-//createOrFindBy
-    public function createOrderByWMSOrderNo($oracleOrderNo)
+    public function findOrCreateByClientCode($clientCode)
     {
-        $order = Order::where('code', $oracleOrderNo)->first();
-        $orderHeader = OracleDOCOrderHeader::where('OrderNo', trim($oracleOrderNo, "'"))->first();
+        $order = Order::where('client_code', $clientCode)->first();
+        $orderHeader = OracleDOCOrderHeader::where('SOREFERENCE1',$clientCode )->first();
         if ($orderHeader == null) {
             return null;
         }
@@ -41,13 +41,7 @@ class OrderService
                 $shop = Shop::firstOrCreate(['name' => $shop_name, 'owner_id' => $owner_id]);
                 $shop_Id = $shop->id;
             }
-            $logistics = Logistic::where(['name' => $orderHeadAttr['CarrierName']])->first();
-/*            if ($logistics == null) {
-                $oracleBasCustomer = OracleBasCustomer::where(['Descr_C' => $orderHeadAttr['CarrierName'], 'Customer_Type' => 'CA'])->first();
-                if ($oracleBasCustomer) {
-                    $logistics = Logistic::firstOrCreate(['code' => $oracleBasCustomer->customerid, 'name' => $oracleBasCustomer->descr_c]);
-                }
-            }*/
+            $logistics = Logistic::where(['name' => $orderHeadAttr['carriername']])->first();
             $logistics_id = null;
             if ($logistics) {
                 $logistics_id = $logistics->id;
@@ -65,28 +59,13 @@ class OrderService
                 'city' => $orderHeadAttr['c_city'],
                 'district' => $orderHeadAttr['c_district'],
                 'address' => $orderHeadAttr['c_address1'],
+                'client_code'=> $orderHeadAttr['soreference1'],
             ];
-
             $order = Order::create($arr);
-            // $order = Order::create([]);
             $orderPackageService = app('orderPackageService');
-            $order->packages = $orderPackageService->createdByOrder($order, $orderHeader);
-        } else {
-            return $this->getOrderInfo($order['id']);
-        }
-        return $order;
-    }
-
-    public function getOrderInfoByLogisticNumberReturn($logisticNumberReturn){
-        $ASNHeader =  OracleDOCASNHeader::where('ASNReference3',$logisticNumberReturn)->first();
-        if(!$ASNHeader){
-            return null;
-        }
-        $OrderHeader = OracleDOCOrderHeader::where('SOReference1',$ASNHeader->asnreference2)->first();
-        if(!$OrderHeader){
-            return null;
+            $orderPackageService->createdByOrder($order);
         }
-        return $this->createOrderByWMSOrderNo($OrderHeader->orderno);
+        return $this->getOrderInfo($order['id']);
     }
 
     public function getOrderInfo($orderId)
@@ -98,36 +77,27 @@ class OrderService
         }])->where('id', $orderId)->first();
     }
 
-    public function getOrderInfoByWMSNo($code)
-    {
-        return Order::with(['packages' => function ($query) {
-            return $query->with(['commodities' => function ($query) {
-                return $query->with(['commodity']);
-            }]);
-        }])->where('code', $code)->first();
-    }
-
-    public function getWMSOrderInfoByWMSOrderNo($WMSOrderNo)
-    {
-        if(!OracleDOCOrderHeader::where('orderNo',$WMSOrderNo)->count()){
-            return [];
+    public function getRejectedBillOfClientCode($clientCode){
+        $orderHeader = OracleDOCOrderHeader::where('SOReference1',$clientCode)->first();
+        if(!$orderHeader){
+            return null;
         }
-        $orderHeader = $this->getWMSOrderHeaderByWMSOrderNo($WMSOrderNo);
-        $orderDetails = $this->getWMSOrderDetailsByWMSOrderNo($WMSOrderNo);
-        $allocationDetails = $this->getWMSOrderAllDetailsByWMSOrderNo($WMSOrderNo);
-        return compact('orderHeader','orderDetails','allocationDetails');
-    }
-
-    public function getWMSOrderHeaderByWMSOrderNo($WMSOrderNo){
-        return OracleDOCOrderHeader::where('orderNo',$WMSOrderNo)->first();
-    }
-
-    public function getWMSOrderDetailsByWMSOrderNo($WMSOrderNo){
-        return OracleDOCOrderDetail::where('orderNo',$WMSOrderNo)->get();
+        $ASNHeader =  OracleDOCASNHeader::where('ASNReference2',$orderHeader->soreference2)->first();
+        if(!$ASNHeader){
+            return null;
+        }
+        return  RejectedBill::with(['owner','logistic','items'])->where('logistic_number_return',$ASNHeader->asnreference2)->first();
     }
 
-    public function getWMSOrderAllDetailsByWMSOrderNo($WMSOrderNo){
-        return OracleActAllocationDetails::where('orderNo',$WMSOrderNo)->get();
+    public function findOrCreteByLogisticNumberReturn($logisticNumberReturn){
+        $ASNHeader = OracleDOCASNHeader::where('ASNReference3',$logisticNumberReturn)->first();
+        if(!$ASNHeader){
+            return null;
+        }
+        $orderHeader = OracleDOCOrderHeader::where('SOReference1',$ASNHeader->ASNReference2);
+        if(!$orderHeader){
+            return null;
+        }
+        return $this->findOrCreateByClientCode($orderHeader[soreference1]);
     }
-
 }

+ 7 - 3
app/Services/RejectedService.php

@@ -141,12 +141,16 @@ class RejectedService
         OrderIssue::where('order_id', $order->id)->where('is_new_rejecting', '<>', 2)->update('is_new_rejecting', 2);
     }
 
-    public function getRejectedByWMSOrderNo($WMSOrderNo){
-        $orderHeader = OracleDOCOrderHeader::where('orderNo',$WMSOrderNo)->first();
+    public function getRejectedByClientNo($clientNo){
+        $orderHeader = OracleDOCOrderHeader::where('SOREFERENCE1',$clientNo)->first();
         if(!$orderHeader){
             return null;
         }
-        $ASNHeader =  OracleDOCASNHeader::where('ASNReference3',$orderHeader->sorefernce1)->first();
+        $rejectedBill = RejectedBill::with('items')->where('order_number',$orderHeader->orderno)->first();
+        if($rejectedBill){
+            return $rejectedBill;
+        }
+        $ASNHeader =  OracleDOCASNHeader::where('ASNREFERENCE2',$clientNo)->first();
         if(!$ASNHeader){
             return null;
         }

+ 6 - 8
app/Services/WaveService.php

@@ -49,8 +49,6 @@ class WaveService
         $sql .= " left join BAS_CODES codes on wave_header.WaveStatus = codes.CODE and codes.codeId = 'SO_STS'";
         return $sql;
     }
-
-    // cancel Print
     public function cancelPrint($ids)
     {
         $meg = ['success' => false, 'fail_info' => null];
@@ -62,11 +60,11 @@ class WaveService
             $ids = [$ids];
         }
         $count = $this->verfifyIds($ids);
-        if(!$count) {
+        if (!$count) {
             $meg['fail_info'] = "取消打印的波次中有不符合条件的波次";
             return $meg;
         }
-        $cancelPrint = OracleDOCWaveHeader::whereIn("WAVENO", $ids)->update(['udfprintflag2' => 'N','UserDefine2'=>'']);
+        $cancelPrint = OracleDOCWaveHeader::whereIn("WAVENO", $ids)->update(['udfprintflag2' => 'N', 'UserDefine2' => '']);
         if (!$cancelPrint) {
             $meg['fail_info'] = '没有选中需要重置打印标记的波次!';
             return $meg;
@@ -211,9 +209,9 @@ class WaveService
         return $sqlString;
     }
 
-    public function verfifyIds($ids){
-        $sql =  "select count(1) count from DOC_WAVE_HEADER where  WaveNo in (".$this->getWaveNoString(implode(',',$ids)).") and WAVESTATUS ='99' and UdfPrintFlag2 ='Y'";
-        $count=  DB::connection('oracle')->select(DB::raw($sql))[0]->count;
-        return $count = 0;
+    public function verfifyIds($ids)
+    {
+        $count = OracleDOCWaveHeader::whereIn('WaveNo', $ids)->where('WAVESTATUS', '99')->where('UdfPrintFlag2', 'Y')->count();
+        return $count == 0;
     }
 }

+ 2 - 2
app/Services/common/QueryService.php

@@ -23,12 +23,12 @@ Class QueryService
         if ($tableName) $tableName .= ".";
         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){
-            if (!($params[$param] ?? false))continue;
+            if (!($params[$param] ?? false) || !$params[$param])continue;
             $isExecute = true;
             $column = $param;
             foreach ($rules as $rule => $value){

+ 10 - 0
app/Validators/UserDutyCheckValidator.php

@@ -0,0 +1,10 @@
+<?php
+
+
+namespace App\Validators;
+
+
+class UserDutyCheckValidator
+{
+
+}

+ 2 - 2
app/library/baidu-api-speech/lib/AipBCEUtil.php

@@ -298,7 +298,7 @@ class AipSampleSigner
     }
 
     /**
-     * 根据headsToSign过滤应该参与签名的header
+     * 根据headsToSign筛选应该参与签名的header
      * @param  array $headers
      * @param  array $headersToSign
      * @return array
@@ -328,7 +328,7 @@ class AipSampleSigner
 
         $filtered_keys = null;
         if ($headersToSign !== null) {
-            //如果有headersToSign,则根据headersToSign过滤
+            //如果有headersToSign,则根据headersToSign筛选
 
             //预处理headersToSign:去掉前后的空白并转化成小写
             $headersToSign = array_map($trim_and_lower, $headersToSign);

+ 23 - 0
database/factories/InventoryFactory.php

@@ -0,0 +1,23 @@
+<?php
+
+/** @var \Illuminate\Database\Eloquent\Factory $factory */
+
+use App\InventoryAccount;
+use App\Owner;
+use Faker\Generator as Faker;
+
+$factory->define(InventoryAccount::class, function (Faker $faker) {
+    $owners=Owner::select('id')->get();
+    return [
+        'owner_id'=>$owners[1],
+        'type'=>'动盘',
+        'start_at'=>now(),
+        'end_at'=>now(),
+        'total'=>3,
+        'processed'=>0,
+        'difference'=>0,
+        'returned'=>0,
+        'deleted_at'=>null,
+        'created_at'=>now(),
+    ];
+});

+ 31 - 0
database/factories/InventoryMissionFactory.php

@@ -0,0 +1,31 @@
+<?php
+
+/** @var \Illuminate\Database\Eloquent\Factory $factory */
+
+use App\InventoryAccountMission;
+use App\Commodity;
+use Faker\Generator as Faker;
+use Illuminate\Support\Str;
+
+$factory->define(InventoryAccountMission::class, function (Faker $faker) {
+    $commoditys=Commodity::get();
+    return [
+        'inventory_account_id'=>'',
+        'location'=>Str::random(5),
+        'commodity_id'=>$commoditys[0]['id'],
+        'produced_at'=>'',
+        'valid_at'=>'',
+        'stored_at'=>'',
+        'batch_number'=>'',
+        'erp_type_position'=>'',
+        'quality'=>'',
+        'stored_amount'=>50,
+        'valid_amount'=>'',
+        'verified_amount'=>'',
+        're_checked_amount'=>'',
+        'difference_amount'=>'',
+        'occupied_amount'=>'',
+        'checked'=>'否',
+        'returned'=>'无',
+    ];
+});

+ 2 - 1
database/factories/UserFactory.php

@@ -17,8 +17,9 @@ use Faker\Generator as Faker;
 */
 
 $factory->define(User::class, function (Faker $faker) {
+    $userNames=config('users.superAdmin');
     return [
-        'name' => $faker->name,
+        'name' => $userNames[0],
         'email' =>  $faker->unique()->safeEmail,
         'email_verified_at' => now(),
         'password' => '$2y$10$vvcID/Akq2KjOZwRUUgBJOpVyGi.nTDT8Yb7gxiy5Xj9/5GnpzBMi', // password

+ 39 - 0
database/migrations/2020_08_20_172156_add_order_client_no.php

@@ -0,0 +1,39 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class AddOrderClientNo extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('orders', function (Blueprint $table) {
+            $table->string('client_code')->index()->nullable()->comment('客户订单编号');
+        });
+        Schema::table('order_issues', function (Blueprint $table) {
+            $table->dropColumn('handle_status');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('orders', function (Blueprint $table) {
+            $table->dropColumn('client_code');
+        });
+        Schema::table('order_issues', function (Blueprint $table) {
+            $table->enum('handle_status', ['处理中', '已完结'])->default('处理中')->comment('处理状态');
+            $table->enum("status",['处理中','未处理','已处理','取消','异常'])->default('未处理');
+        });
+    }
+}

+ 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');
+    }
+}

+ 1 - 0
phpunit-Inventory.bat

@@ -0,0 +1 @@
+vendor\bin\phpunit.bat --testsuite=Inventory

+ 3 - 0
phpunit.xml

@@ -18,6 +18,9 @@
         <testsuite name="Feature">
             <directory suffix="Test.php">./tests/Feature</directory>
         </testsuite>
+        <testsuite name="Inventory">
+            <directory suffix="Test.php">./tests/Inventory</directory>
+        </testsuite>
         <testsuite name="OrderIssues">
             <directory suffix="Test.php">./tests/OrderIssues</directory>
         </testsuite>

+ 5 - 5
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 () {
@@ -61974,8 +61974,8 @@ module.exports = tempTip;
 /*! no static exports found */
 /***/ (function(module, exports, __webpack_require__) {
 
-__webpack_require__(/*! D:\Demo\bswas\resources\js\app.js */"./resources/js/app.js");
-module.exports = __webpack_require__(/*! D:\Demo\bswas\resources\sass\app.scss */"./resources/sass/app.scss");
+__webpack_require__(/*! D:\Reald\desktop\BsWAS\src\resources\js\app.js */"./resources/js/app.js");
+module.exports = __webpack_require__(/*! D:\Reald\desktop\BsWAS\src\resources\sass\app.scss */"./resources/sass/app.scss");
 
 
 /***/ }),
@@ -61991,4 +61991,4 @@ module.exports = __webpack_require__(/*! D:\Demo\bswas\resources\sass\app.scss *
 
 /***/ })
 
-/******/ });
+/******/ });

+ 14 - 3
resources/js/queryForm/header.js

@@ -7,7 +7,7 @@
 window.sort=require('../utilities/sort');
 window.Header = function getHeader(object) {
     this._header = object.el || '#header';  //基点元素
-    this._column = object.column;   //列名
+    this._columns = object.column;   //列名
     this._data = object.data;   //被排序数据
     this._restorationColumn = object.restorationColumn; //恢复原数据基准字段
     this._fixedTop = object.fixedTop || 0;  //同级浮动元素高度,使当前元素追加该元素高度浮动
@@ -41,6 +41,17 @@ window.Header = function getHeader(object) {
                 _parentNodeTemp.css('margin-left',"");
             }
         });
+        let resetTrWidth = function(){
+            _parentNodeTemp.css('width',($(document).width()-_parentNodeTemp.offset().left*2)+'px');
+                // _this._columns.forEach(function (column){
+                //     let protoTargetWidth = (parseInt($("#dom_" + column.name ).css('width')))-16;
+                //     let floatingColumn = $("#dom_" + column.name + "_temp");
+                //     floatingColumn.css('width', protoTargetWidth);
+                //     floatingColumn.find('span').css('width', protoTargetWidth);
+                // })
+        };
+        $(window).resize(resetTrWidth);
+        setTimeout(resetTrWidth,200)
     }
 
     /**
@@ -130,7 +141,7 @@ window.Header = function getHeader(object) {
     };
     //追加表头字段
     function append() {
-        _this._column.forEach(function (column) {
+        _this._columns.forEach(function (column) {
             if (column.customization){
                 let _th = $("<th id='dom_"+column.name+"'><span style='display: inline-block'></span></th>");
                 $(_th.children()[0]).append(column.dom);
@@ -171,7 +182,7 @@ window.Header = function getHeader(object) {
         _parentNodeTemp.height(height);
         _parentNodeTemp.attr('id',_parentNode.attr('id')+"Temp");
         $(_this._header+"Roll").append(_parentNodeTemp);
-        _this._column.forEach(function (column) {
+        _this._columns.forEach(function (column) {
             let column_dom = $('#dom_'+column.name);
             let column_dom_temp = column_dom.clone();
             let columnNameDom = column_dom_temp.children()[0];

+ 4 - 4
resources/js/queryForm/queryForm.js

@@ -170,9 +170,9 @@ const query = function getQueryForm(data) {
         _table.css('width', max_width + 'px');
     }
 
-    // 清空过滤条件按钮
+    // 清空筛选按钮
     function crateClearBtn() {
-        let clearbtn = $("<button type='button' class='btn btn-warning text-dark '>清除过滤条件</button>");
+        let clearbtn = $("<button type='button' class='btn btn-warning text-dark '>清除筛选</button>");
         clearbtn.click(function () {
             clearData();
             visibleClearBtn();
@@ -672,7 +672,7 @@ const query = function getQueryForm(data) {
             label.show();
         }
     }
-    
+
     // modify _data
     function modifyData(dom) {
         _data[dom.name].mold = dom.mold;
@@ -762,7 +762,7 @@ const query = function getQueryForm(data) {
         endDate = new Date(endDate);
         return Math.floor((endDate.getTime() - startDate.getTime())/(24*3600*1000));
     }
-    
+
     function getSubDate(date,value) {
         date = new Date(date);
         date.setDate(date.getDate() - value);

+ 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 - 200
resources/views/inventory/statement/allInventory.blade.php

@@ -1,200 +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

+ 7 - 5
resources/views/inventory/statement/changeInventory.blade.php

@@ -1,14 +1,12 @@
 @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="导出所有页将会以搜索条件得到的过滤结果,将其全部记录(每一页)导出">
+                data-toggle="dropdown" title="导出所有页将会以搜索条件得到的筛选结果,将其全部记录(每一页)导出">
             导出Excel
         </button>
         <div class="dropdown-menu">
@@ -36,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>
@@ -56,8 +56,8 @@
 
 @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 type="text/javascript" src="{{asset('js/queryForm/queryForm200825.js')}}"></script>
+    <script type="text/javascript" src="{{asset('js/queryForm/header200826b.js')}}"></script>
     <script>
         let vue=new Vue({
             el:"#list",
@@ -134,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>

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

@@ -1,13 +1,12 @@
 @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>
-        </li>
-    @endcomponent
+        @component('inventory.stockInventory.menu')
+            <li class="nav-item">
+                <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">
@@ -21,37 +20,58 @@
         <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>
         </span>
-            <span class="form-group pl-5 shadow-sm p-2 mb-5 bg-white rounded">
+        <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>
-            <span class="form-group pl-5 shadow-sm p-2 mb-5 bg-white rounded">
+        <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>
+            <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>
+            <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>
         </div>
         <div class="mt-4 ml-5" >
-        <span class="btn col-1 font-weight-bold"  style="cursor: default" :class="inventory.surplus!=0?'bg-info':''">
+        <span class="btn col-1 font-weight-bold"  style="cursor: default" :class="inventory.surplus!=0?'bg-info':'btn-outline-info disabled'">
             @{{ inventory.type }}
         </span>
-            <span class="btn btn-outline-info col-1 disabled font-weight-bold">复盘</span>
+            <span class="btn col-1 font-weight-bold" style="cursor: default" :class="inventory.surplus!=0?'btn-outline-info disabled':'bg-info'">复盘</span>
         </div>
-{{--        method="POST"  action='{{url('inventory/stockInventory/stockInventory/'.$inventory->owner['id'])}}' @csrf   @method('PUT')--}}
-        <form id="form"   class="mt-3 pl-5">
-            <div class="row row-cols-3">
+
+        <form id="form"  class="mt-3 pl-5">
+            <div class="row" :class="inventory.surplus!=0?'row-cols-3':'row-cols-5'">
         <span>
-            <label class="text-secondary font-weight-bold">请输入库位</label>
-            <input id="inventoryInput" name="location" type="text" class="form-control col-6 input"  autocomplete="off">
+            <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">
+        </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">
+        </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">
+        </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>
+            </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>
+            </span>
         </span>
-                <span>
-                    <label class="text-secondary font-weight-bold">请输入产品条码</label>
-                    <input id="barcode" name="barcode" type="text" class="form-control col-6 input" autocomplete="off" @blur="searchBarcode">
-                </span>
-                <span>
-            <label class="text-secondary font-weight-bold">请输入盘点数</label>
-            <input type="text" id="count" name="count" class="form-control col-6 input"  autocomplete="off">
+        <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>
         </span>
             </div>
         </form>
 
+
         <table class="table table-sm table-striped table-bordered table-hover text-nowrap card-body mt-2">
             <tr>
                 <th>序号</th>
@@ -71,6 +91,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':''}">
                 <td>@{{ i+1 }}</td>
                 <td>@{{ inventoryMission.location }}</td>
@@ -92,6 +113,7 @@
         </table>
     </div>
 
+
 @endsection
 
 @section('lastScript')
@@ -99,10 +121,11 @@
         let listVue = new Vue({
             el: "#list",
             data: {
-                inventory:{!! $inventory!!},
-                inventoryMissions:{!! $inventoryMissions !!},
+                inventory:{!! $inventoryAccount!!},
+                inventoryMissions:{!! $inventoryAccountMissions !!},
                 checkData: [],
                 selectedStyle:'',
+                inventoryMissionRecord:{},
             },
             mounted: function () {
                 $(".tooltipTarget").tooltip({'trigger': 'hover'});
@@ -119,15 +142,31 @@
                 },
                 //验证输入盘点产品条码对应是否有商品
                 searchBarcode(){
-                    let barcode=document.getElementById('barcode').value;
                     let _this=this;
+                    let barcode=document.getElementById('barcode').value;
+                    let location=document.getElementById('inventoryInput').value;
+                    let inventoryId=_this.inventory.id;
                     let barcodes=[];
                     _this.inventoryMissions.forEach(function (inventoryMission) {
                         barcodes.push(inventoryMission.commodity.barcode);
                     });
                     if (!barcodes.includes(barcode)){
                         tempTip.setDuration(2000);
-                        tempTip.show('你输入的产品条码没有对应的产品!');
+                        tempTip.show('输入的产品条码没有对应的产品!');
+                    }else {
+                        //根据该库存和产品条码查询该条盘点记录
+                        let url='{{url('inventory/searchStockInventoryRecord')}}';
+                        axios.post(url,{location:location,barcode:barcode,inventoryId:inventoryId}).then(function (response) {
+                            if (!response.data.success){
+                                tempTip.setDuration(2000);
+                                tempTip.show('复盘!'+'   '+response.data.data);
+                            }else {
+                                _this.inventoryMissionRecord=response.data.data;
+                            }
+                        }).catch(function (err) {
+                            tempTip.setDuration(2000);
+                            tempTip.show('网络错误'+err);
+                        });
                     }
                 },
                 //提交盘点
@@ -147,12 +186,14 @@
                                 if (_this.inventory.id==response.data.inventory.id){
                                     _this.inventory.processed=response.data.inventory.processed;
                                     _this.inventory.surplus=response.data.inventory.surplus;
+                                    _this.inventory.check_surplus=response.data.inventory.check_surplus;
                                 }
                                 _this.inventoryMissions.every(function (inventoryMission,i) {
                                     if (inventoryMission.id==response.data.inventoryMission.id){
                                         inventoryMission.checked=response.data.inventoryMission.checked;
                                         inventoryMission.verified_amount=response.data.inventoryMission.verified_amount;
                                         inventoryMission.difference_amount=response.data.inventoryMission.difference_amount;
+                                        inventoryMission.re_checked_amount=response.data.inventoryMission.re_checked_amount;
                                         _this.inventoryMissions.splice(i,1)
                                         _this.inventoryMissions.unshift(inventoryMission);
                                         return false;
@@ -162,27 +203,27 @@
                                 tempTip.setDuration(3000);
                                 tempTip.showSuccess('盘点成功!');
                             }
-                    }).catch(function (err) {
+                        }).catch(function (err) {
                         tempTip.setDuration(2000);
                         tempTip.show('盘点失败!'+'网络错误'+err);
                     })
                 },
             }
         });
-        $("#form").on("keydown","input",function(){
+       $("#form").on("keydown","input",function(){
             let _this=this;
             let e = event || window.event;
             if(e && e.keyCode==13) {
                 let inputs = $("#form .input");
                 let idx = inputs.index(this);     // 获取当前焦点输入框所处的位置
                 let location=document.getElementById('inventoryInput').value;
-                if (idx == inputs.length - 1) {       // 判断是否是最后一个输入框
+                if (idx == 2) {       // 判断是否是最后一个输入框
                     if (location==''||location==undefined||location==null){
                         document.getElementById('inventoryInput').focus();
                         return;
                     }
                     listVue.submitStockInventory();
-                    $("#form .input").val('');
+                    $("#form .input").val(' ');
                     document.getElementById('inventoryInput').focus();
                 } else {
                     inputs[idx + 1].focus(); // 设置焦点

+ 129 - 55
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>
@@ -62,24 +67,34 @@
                 <td>@{{ inventory.difference }}</td>
                 <td>@{{ inventory.returned }}</td>
                 <td>
-                    <span class="btn  btn-sm btn-outline-danger">删除</span>
+                    <span class="btn  btn-sm btn-outline-danger" @click="deleteStockInventoryMission(inventory.id)">删除</span>
                 </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,28 +155,85 @@
                 //生成盘点任务
                 createInventoryMission(){
                     let _this=this;
+                    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(1000);
-                                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){
+                    if(!confirm('确定要删除盘点单号为:“'+id+'”的运单吗?')){return};
+                    let url = '{{url('inventory/deleteStockInventoryMission')}}/'+id;
+                    axios.delete(url).then(
+                        function (response) {
+                            if(!response.data.success){
+                                tempTip.setDuration(3000);
+                                tempTip.show('盘点单号:'+id+'删除失败!');
+                            }else {
+                                tempTip.setDuration(3000);
+                                tempTip.showSuccess('盘点单号:'+id+'删除成功!');
+                                setInterval(function () {
+                                    window.location.reload();
+                                },1000)
+                            }
+                        }
+                    ).catch(function (err) {
+                        tempTip.setDuration(3000);
+                        tempTip.show('删除失败,网络链接错误!'+err);
+                    });
+                },
+                hasDateStart(){
+                  this.date_start=document.getElementById('date_start').value;
+                },
+                hasDateEnd(){
+                    this.date_end=document.getElementById('date_end').value;
+                },
             }
         });
     </script>

+ 12 - 2
resources/views/maintenance/role/index.blade.php

@@ -8,6 +8,7 @@
     </span>
     <div class="container-fluid">
         <div class="card">
+            <div id="form_div"></div>
             <div class="card-body" id="list">
                 @if(Session::has('successTip'))
                     <div class="alert alert-success h1">{{Session::get('successTip')}}</div>
@@ -49,7 +50,8 @@
 @endsection
 
 @section('lastScript')
-    <script type="text/javascript" src="{{asset('js/queryForm/header200819.js')}}"></script>
+    <script type="text/javascript" src="{{asset('js/queryForm/queryForm200825.js')}}"></script>
+    <script type="text/javascript" src="{{asset('js/queryForm/header200826b.js')}}"></script>
     <script>
         new Vue({
             el:"#list",
@@ -61,11 +63,19 @@
                     },
                     @endforeach
                 ],
+                form:'',
             },
             mounted:function(){
+                let data = [[
+                    {name:'role',type:'input',tip:'角色名:可在两侧添加百分号(%)进行模糊搜索',placeholder:'角色名'}]];
+                this.form = new query({
+                    el: '#form_div',
+                    condition: data,
+                })
+                this.form.init();
                 let column = [
                     {name:'id',value: 'ID'},
-                    {name:'name',value: '用户名'},
+                    {name:'name',value: '角色'},
                     {name:'alias_name',value: '允许权限', neglect: true},
                     {name:'alias_name_false',value: '禁止权限', neglect: true},
                     {name:'created_at',value: '创建时间'},

+ 30 - 11
resources/views/maintenance/user/index.blade.php

@@ -8,6 +8,7 @@
     </span>
     <div class="container-fluid">
         <div class="card">
+            <div id="form_div"></div>
             <div class="card-body">
                 @if(Session::has('successTip'))
                     <div class="alert alert-success h1">{{Session::get('successTip')}}</div>
@@ -15,6 +16,12 @@
                 <div id="list">
                     <table class="table table-bordered table-sm d-none" id="headerRoll"></table>
                     <table class="table table-striped table-sm" id="headerParent">
+                        <tr>
+                            <th data_field="id">id</th>
+                            <th data_field="name">name</th>
+                            <th>xx</th>
+                            <th>xxz</th>
+                        </tr>
                         <tr id="header"></tr>
                         <tr v-for="user in users">
                             <td class="text-muted">@{{user.id}}</td>
@@ -49,7 +56,11 @@
 @endsection
 
 @section('lastScript')
-    <script type="text/javascript" src="{{asset('js/queryForm/header200819.js')}}"></script>
+    <script>
+
+    </script>
+    <script type="text/javascript" src="{{asset('js/queryForm/queryForm200825.js')}}"></script>
+    <script type="text/javascript" src="{{asset('js/queryForm/header200826b.js')}}"></script>
     <script>
         new Vue({
             el:"#list",
@@ -61,18 +72,26 @@
                         roles:{!! $user->roles !!},carriers:{!! $user->carriers !!},workgroup:{!! $user->userWorkgroups !!},created_at:'{{$user->created_at}}'},
                     @endforeach
                 ],
+                form:'',
             },
             mounted:function(){
-                let column = [
-                    {name:'id',value: 'ID'},
-                    {name:'name',value: '用户名'},
-                    {name:'role_name',value: '角色', neglect: true},
-                    {name:'workgroup_name',value: '工作组', neglect: true},
-                    {name:'carrier_name',value: '配置承运商', neglect: true},
-                    {name:'email',value: '邮件地址'},
-                    {name:'created_at',value: '创建时间'},
-                    {name:'operation',value: '操作', neglect: true},
-                ];
+                let data = [[{name:'user',type:'input',tip:'用户名:可在两侧添加百分号(%)进行模糊搜索',placeholder:'用户名'},
+                    {name:'role',type:'input',tip:'角色名:可在两侧添加百分号(%)进行模糊搜索',placeholder:'角色名'}]];
+                this.form = new query({
+                    el: '#form_div',
+                    condition: data,
+                })
+                this.form.init();
+                // let column = [
+                //     {name:'id',value: 'ID'},
+                //     {name:'name',value: '用户名'},
+                //     {name:'role_name',value: '角色', neglect: true},
+                //     {name:'workgroup_name',value: '工作组', neglect: true},
+                //     {name:'carrier_name',value: '配置承运商', neglect: true},
+                //     {name:'email',value: '邮件地址'},
+                //     {name:'created_at',value: '创建时间'},
+                //     {name:'operation',value: '操作', neglect: true},
+                // ];
                 let header = new Header({
                     column: column,
                     data: this.users,

+ 29 - 11
resources/views/order/index/delivering.blade.php

@@ -10,7 +10,7 @@
                 <div class="ml-3 form-inline">
                     <span class="dropdown">
                         <button type="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="导出所有页将会以搜索条件得到的过滤结果,将其全部记录(每一页)导出">
+                                data-toggle="dropdown" title="导出所有页将会以搜索条件得到的筛选结果,将其全部记录(每一页)导出">
                             导出Excel
                         </button>
                         <div class="dropdown-menu">
@@ -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>
@@ -140,8 +140,8 @@
 
 @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 type="text/javascript" src="{{asset('js/queryForm/queryForm200825.js')}}"></script>
+    <script type="text/javascript" src="{{asset('js/queryForm/header200826b.js')}}"></script>
     <script>
         let vue=new Vue({
             el:"#list",
@@ -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){
@@ -495,8 +511,8 @@
                 },
                 orderIssueTag(){
                    // 标记问题单
-                    let _this=this;
-                    if(_this.checkData.length===0){
+                    let _this = this;
+                    if( _this.checkData.length === 0){
                         tempTip.show('没有勾选记录');
                         return
                     }
@@ -507,7 +523,10 @@
                         tempTip.cancelWaitingTip();
                         if(res.data.success){
                             tempTip.setDuration(3000);
-                            tempTip.showSuccess('已标记为问题件');
+                            tempTip.showSuccess('已标记为问题件,稍后前往订单问题件查询页面');
+                            setTimeout(function(){
+                                window.location.href = "{{url('order/issue/index')}}";
+                            },1000);
                         }else{
                             tempTip.setDuration(4000);
                             tempTip.show(res.data.fail_info);
@@ -517,7 +536,6 @@
                         tempTip.cancelWaitingTip();
                         tempTip.show('网络链接异常'+err);
                     })
-
                 },
             },
         });

+ 100 - 158
resources/views/order/issue/create.blade.php

@@ -17,25 +17,24 @@
                         <div class="form-group row">
                             <label for="logistic_number_return" class="col-2 col-form-label text-right ">退回单号</label>
                             <div class="col-8 ">
-                                <input type="text" name="logistic_number_return" id="logistic_number_return"
-                                       class="form-control col-lg-5 @error('logistic_number_return') is-invalid @enderror"
+                                <input type="text" name="logistic_number_return" id="logistic_number_return" class="form-control col-lg-5 @error('logistic_number_return') is-invalid @enderror"
                                        v-model="logistic_number_return"
-                                       @blur="checkLogisticNumberReturn()"
-                                       value="@if(old('logistic_number_return')){{old('logistic_number_return')}}@endif">
+                                       value="@if(old('logistic_number_return')){{old('logistic_number_return')}}@endif"
+                                       @blur="checkLogisticNumberReturn">
                                 @error('logistic_number_return')
                                 <span class="invalid-feedback" role="alert"><strong>{{ $message }}</strong></span>
                                 @enderror
                             </div>
                         </div>
                         <div class="form-group row">
-                            <label for="wms_order_no" class="col-2 col-form-label text-right ">原始WMS订单号</label>
+                            <label for="wms_order_no" class="col-2 col-form-label text-right ">原始客户订单号</label>
                             <div class="col-8">
-                                <input type="text" name="wms_order_no" id="wms_order_no"
-                                       class="form-control col-lg-5 @error('wms_order_no') is-invalid @enderror"
-                                       @blur="checkWMSOrderNo($event)"
-                                       v-model="wms_order_no"
-                                       value="@if(old('wms_order_no')){{old('wms_order_no')}}@endif">
-                                @error('wms_order_no')
+                                <input type="text" name="client_code" id="client_code"
+                                       class="form-control col-lg-5 @error('client_code') is-invalid @enderror"
+                                       value="@if(old('client_code')){{old('client_code')}}@endif"
+                                       @blur="checkClientCode($event)"
+                                       v-model="client_code">
+                                @error('client_code')
                                 <span class="invalid-feedback" role="alert"><strong>{{ $message }}</strong></span>
                                 @enderror
                             </div>
@@ -43,10 +42,10 @@
                         <div class="form-group row">
                             <label for="order_issue_type_id" class="col-2 col-form-label text-right text-primary"><span class="text-danger">*</span>问题类别</label>
                             <div class="col-8">
-                                <select name="order_issue_type_id" id="order_issue_type_id"
-                                        class="form-control @error('order_issue_type_id') is-invalid @enderror" v-model="order_issue_type_id">
+                                <select name="order_issue_type_id" id="order_issue_type_id" v-model="order_issue_type_id"
+                                        class="form-control @error('order_issue_type_id') is-invalid @enderror">
                                     <option value></option>
-                                    <option v-for="type in types " :value="type.id">@{{ type.name }}</option>
+                                    <option v-for="type in types" :value="type.id">@{{ type.name }}</option>
                                 </select>
                                 @error('order_issue_type_id')
                                 <span class="invalid-feedback" role="alert"><strong>{{ $message }}</strong></span>
@@ -64,23 +63,21 @@
                                 </div>
                                 <table class="table table-responsive-sm" v-if="order.packages">
                                     <tr>
-                                        <th>条码</th>
-                                        <th>商品名</th>
-                                        <th>数量</th>
+                                        <th>条码</th><th>商品名</th><th>数量</th>
                                     </tr>
-                                    <tr v-for="packages in order.packages">
-                                        <template v-for="items in packages.commodities">
+                                    <template v-for="packages in order.packages">
+                                        <tr v-for="items in packages.commodities">
                                             <td>@{{ items.commodity.sku }}</td>
                                             <td>@{{ items.commodity.name }}</td>
                                             <td>@{{ items.amount }}</td>
-                                        </template>
-                                    </tr>
+                                        </tr>
+                                    </template>
                                 </table>
                             </div>
                         </div>
                         <div class="form-group row">
                             <label for="" class="col-2 col-form-label text-right ">退回单商品详情</label>
-                            <div class="col-8" id="">
+                            <div class="col-8">
                                 <div class="alert alert-success" role="alert" v-if="rejectedBill.items">
                                     商品详情已填充
                                 </div>
@@ -89,11 +86,7 @@
                                 </div>
                                 <table class="table table-responsive-sm" v-if="rejectedBill.items">
                                     <tr>
-                                        <th>条码</th>
-                                        <th>商品名</th>
-                                        <th>数量</th>
-                                        <th>是否正品</th>
-                                        <th>备注</th>
+                                        <th>条码</th><th>商品名</th><th>数量</th><th>是否正品</th><th>备注</th>
                                     </tr>
                                     <tr v-for="item in rejectedBill.items">
                                         <td>@{{ item.barcode_goods }}</td>
@@ -106,10 +99,11 @@
                             </div>
                         </div>
                         <div class="form-group row">
-                            <label for="wms_order_no" class="col-2 col-form-label text-right text-primary"><span class="text-danger">*</span>货主</label>
+                            <label for="wms_order_no" class="col-2 col-form-label text-right text-primary"><span
+                                    class="text-danger">*</span>货主</label>
                             <div class="col-8 row">
                                 <div class="form-group col-lg-5">
-                                    <select class="form-control @error('owner_id') is-invalid @enderror" name="owner_id" v-model="order.owner_id" >
+                                    <select class="form-control @error('owner_id') is-invalid @enderror" name="owner_id" v-model="order.owner_id">
                                         <option value></option>
                                         <option v-for="owner in owners" :value="owner.id">@{{ owner.name }}</option>
                                     </select>
@@ -125,9 +119,7 @@
                                 <div class="form-group col-lg-5">
                                     <select class="form-control " name="logistic_id" v-model="order.logistic_id">
                                         <option value></option>
-                                        <option v-for="logistic in logistics" :value="logistic.id">@{{ logistic.name
-                                            }}
-                                        </option>
+                                        <option v-for="logistic in logistics" :value="logistic.id">@{{ logistic.name }}</option>
                                     </select>
                                 </div>
                             </div>
@@ -135,29 +127,27 @@
                         <div class="form-group row">
                             <label for="wms_order_no" class="col-2 col-form-label text-right ">收货人名称</label>
                             <div class="col-8">
-                                <input type="text" name="consignee_name " class="form-control"
-                                       v-model="order.consignee_name">
+                                <input type="text" name="consignee_name " class="form-control" v-model="order.consignee_name">
                             </div>
                         </div>
                         <div class="form-group row">
                             <label for="wms_order_no" class="col-2 col-form-label text-right ">收货人号码</label>
                             <div class="col-8">
-                                <input type="text" name="consignee_phone" class="form-control"
-                                       v-model="order.consignee_phone">
+                                <input type="text" name="consignee_phone" class="form-control" v-model="order.consignee_phone">
                             </div>
                         </div>
                         <div class="form-group row">
                             <label class="col-2 col-form-label text-right ">收货人地址</label>
                             <div class="col-8 row">
                                 <div class="form-group col-lg-4">
-                                    <input type="text" name="province" class="form-control" placeholder="省"
-                                           v-model="order.province"></div>
+                                    <input type="text" name="province" class="form-control" placeholder="省" v-model="order.province">
+                                </div>
                                 <div class="form-group col-lg-4">
-                                    <input type="text" name="city" class="form-control" placeholder="市"
-                                           v-model="order.city"></div>
+                                    <input type="text" name="city" class="form-control" placeholder="市" v-model="order.city"
+                                    ></div>
                                 <div class="form-group col-lg-4">
-                                    <input type="text" name="district" class="form-control" placeholder="区"
-                                           v-model="order.district"></div>
+                                    <input type="text" name="district" class="form-control" placeholder="区" v-model="order.district">
+                                </div>
                             </div>
                         </div>
                         <div class="form-group row">
@@ -166,14 +156,12 @@
                                 <input type="text" name="address" class="form-control " v-model="order.address">
                             </div>
                         </div>
-
                         <div class="form-group row">
-                            <label for="second_order_no" class="col-2 col-form-label text-right">二次订单号</label>
+                            <label for="second_order_no" class="col-2 col-form-label text-right">二次客户订单号</label>
                             <div class="col-8">
                                 <input type="text" name="second_order_no" id="second_order_no" class="form-control"
-                                       value="@if(old('second_order_no')){{old('second_order_no')}}@endif"
-                                       @blur="verifySecondOrder($event)"
-                                       v-model="secondOrderNo">
+                                       value="@if(old('secondClientNO')){{old('secondClientNO')}}@endif"
+                                       v-model="secondClientNO" @blur="verifySecondOrder($event)">
                                 <div class="valid-feedback" style="display: none" id="secondOrderNo_feedback"></div>
                             </div>
                         </div>
@@ -188,19 +176,17 @@
                             </div>
                         </div>
                         <div class="form-group row">
-                            <label for="" class="col-2 col-form-label text-right">二次订单商品明细</label>
+                            <label for="" class="col-2 col-form-label text-right">二次客户订单商品详情</label>
                             <div class="col-8" id="">
                                 <div class="alert alert-success" role="alert" v-if="secondOrder.packages">
-                                    商品详情已填充
+                                    二次客户订单商品详情已填充
                                 </div>
                                 <div class="alert alert-secondary" role="alert" v-else>
-                                    商品明细通过二次订单编号进行自动填充
+                                    二次客户订单商品详情通过二次订单编号进行自动填充
                                 </div>
                                 <table class="table table-responsive-sm" v-if="secondOrder.packages">
                                     <tr>
-                                        <th>条码</th>
-                                        <th>商品名</th>
-                                        <th>数量</th>
+                                        <th>条码</th><th>商品名</th><th>数量</th>
                                     </tr>
                                     <tr v-for="packages in secondOrder.packages">
                                         <template v-for="items in packages.commodities">
@@ -215,15 +201,14 @@
                         <div class="form-group row">
                             <label for="order_issue_type_id" class="col-2 col-form-label text-right ">最终状态</label>
                             <div class="col-8">
-                                <select name="final_status" id="final_status" class="form-control"
-                                        v-model="finalStatus">
+                                <select name="final_status" id="final_status" class="form-control" v-model="finalStatus">
                                     <option value></option>
                                     <option v-for="type in final_status " :value="type">@{{ type }}</option>
                                 </select>
                             </div>
                         </div>
                         <div class="form-group row">
-                            <label for="" class="col-2 col-form-label text-right ">处理结果说明</label>
+                            <label for="" class="col-2 col-form-label text-right ">处理结果</label>
                             <div class="col-8">
                                 <textarea name="result_explain" class="form-control"></textarea>
                             </div>
@@ -233,9 +218,7 @@
                             <label for="logistic_indemnity_money"
                                    class="col-2 col-form-label text-right ">承运商赔偿金额</label>
                             <div class="col-8">
-                                <input type="text" name="logistic_indemnity_money" id="logistic_indemnity_money"
-                                       class="form-control"
-                                       value="@if(old('logistic_indemnity_money')){{old('logistic_indemnity_money')}}@endif">
+                                <input type="text"  class="form-control" name="logistic_indemnity_money" id="logistic_indemnity_money" value="@if(old('logistic_indemnity_money')){{old('logistic_indemnity_money')}}@endif">
                                 @error('logistic_indemnity_money')
                                 <span class="invalid-feedback" role="alert"><strong>{{ $message }}</strong></span>
                                 @enderror
@@ -246,12 +229,9 @@
                             <label for="logistic_express_remission"
                                    class="col-2 col-form-label text-right ">承运商快递减免</label>
                             <div class="col-8">
-                                <select name="logistic_express_remission" id="logistic_express_remission"
-                                        class="form-control"
-                                        v-model='logistic_express_remission'>
+                                <select id="logistic_express_remission" name="logistic_express_remission"  class="form-control" v-model='logistic_express_remission'>
                                     <option value></option>
-                                    <option v-for="remission in Remission " :value="remission">@{{ remission }}
-                                    </option>
+                                    <option v-for="remission in Remission " :value="remission">@{{ remission }}</option>
                                 </select>
                             </div>
                         </div>
@@ -260,8 +240,7 @@
                             <label for="baoshi_indemnity_money"
                                    class="col-2 col-form-label text-right ">宝时赔偿金额</label>
                             <div class="col-8">
-                                <input type="text" name="baoshi_indemnity_money" id="baoshi_indemnity_money"
-                                       class="form-control"
+                                <input  id="baoshi_indemnity_money" type="text" name="baoshi_indemnity_money"  class="form-control"
                                        value="@if(old('baoshi_indemnity_money')){{old('baoshi_indemnity_money')}}@endif">
                                 @error('baoshi_indemnity_money')
                                 <span class="invalid-feedback" role="alert"><strong>{{ $message }}</strong></span>
@@ -273,8 +252,7 @@
                             <label for="baoshi_express_remission"
                                    class="col-2 col-form-label text-right ">宝时快递减免</label>
                             <div class="col-8">
-                                <select name="baoshi_express_remission" id="baoshi_express_remission"
-                                        class="form-control" v-model="baoshi_express_remission">
+                                <select name="baoshi_express_remission" id="baoshi_express_remission" class="form-control" v-model="baoshi_express_remission">
                                     <option value></option>
                                     <option v-for="remission in Remission " :value="remission">@{{ remission }}</option>
                                 </select>
@@ -285,11 +263,9 @@
                             <label for="user_workgroup_id"
                                    class="col-2 col-form-label text-right ">事故责任方</label>
                             <div class="col-8">
-                                <select name="user_workgroup_id" id="user_workgroup_id" class="form-control"
-                                        v-model="userWorkgroupId">
+                                <select name="user_workgroup_id" id="user_workgroup_id" class="form-control" v-model="userWorkgroupId">
                                     <option value></option>
-                                    <option v-for="wrokGroup in userWorkGroup " :value="wrokGroup.id">@{{ wrokGroup.name }}
-                                    </option>
+                                    <option v-for="wrokGroup in userWorkGroup " :value="wrokGroup.id">@{{ wrokGroup.name }}</option>
                                 </select>
                             </div>
                         </div>
@@ -303,24 +279,18 @@
                 </div>
             </div>
         </div>
-
     </div>
 @endsection
 @section('lastScript')
     <script type="text/javascript">
         let crete_vue = new Vue({
-                el: '#issue_create_div',
+            el: '#issue_create_div',
             data: {
-                logistic_number_return: @if(old('logistic_number_return'))"{{old('logistic_number_return')}}"
-                @else''@endif,
-                wms_order_no: @if(old('wms_order_no'))"{{old('wms_order_no')}}"
-                @else''@endif,
-                second_order_id: @if(old('second_order_id'))"{{old('second_order_id')}}"
-                @else''@endif,
-                secondOrderNo: @if(old('secondOrderNo'))"{{old('secondOrderNo')}}"
-                @else''@endif,
-                order_issue_type_id: @if(old('order_issue_type_id'))"{{old('order_issue_type_id')}}"
-                @else''@endif,
+                logistic_number_return: @if(old('logistic_number_return'))"{{old('logistic_number_return')}}"@else''@endif,
+                client_code: @if(old('client_code'))"{{old('client_code')}}"@else''@endif,
+                second_order_id: @if(old('second_order_id'))"{{old('second_order_id')}}"@else''@endif,
+                secondClientNO: @if(old('secondClientNO'))"{{old('secondClientNO')}}"@else''@endif,
+                order_issue_type_id: @if(old('order_issue_type_id'))"{{old('order_issue_type_id')}}"@else''@endif,
                 owners:{!! $owners !!},
                 logistics:{!! $logistic !!},
                 types:{!! $types !!},
@@ -329,27 +299,11 @@
                 order_id: @if(old('order_id')){{old('order_id')}}@else''@endif,
                 isSubmit: false,
                 // 原始订单信息
-                order: {
-                    orderno: '',
-                    logstic_number: '',
-                    address: '',
-                    province: '',
-                    city: '',
-                    district: '',
-                    consignee_name: '',
-                    consignee_phone: '',
-                    carrierid: '',
-                    owner_id: @if(old('owner_id')){{old('owner_id')}}@else '' @endif,
-                    ownerName: '',
-                    order_id: '',
-                },
+                order: {orderno: '', logstic_number: '', address: '', province: '', city: '', district: '', consignee_name: '', consignee_phone: '', carrierid: '', owner_id: @if(old('owner_id')){{old('owner_id')}}@else '' @endif, ownerName: '', order_id: '',},
                 // 二次订单
-                secondOrder: {
-                    logistic_id: '', code: '',
-                },
-                final_status: ['已解决', '已解决', '待退回', '退回中'],
+                secondOrder: {logistic_id: '', code: '',},
+                final_status: ['已解决', '待退回', '退回中'],
                 Remission: ['原单减免', '部分减免', '全部减免'],
-                order_issue_type_id: @if(old('order_issue_type_id')){{old('order_issue_type_id')}}@else''@endif,
                 finalStatus: @if(old('final_status')){{old('final_status')}}@else''@endif,
                 logistic_express_remission: @if(old('logistic_express_remission')){{old('logistic_express_remission')}}@else''@endif,
                 baoshi_express_remission: @if(old('baoshi_express_remission')){{old('baoshi_express_remission')}}@else''@endif,
@@ -358,45 +312,29 @@
             mounted: function () {
                 $("#issue_create_div").removeClass('d-none');
                 if (this.wms_order_no) {
-                    this.checkWMSOrderNo();
+                    this.checkClientCode();
                 }
-                if (this.secondOrderNo) {
+                if (this.secondClientNO) {
                     this.verifySecondOrder();
                 }
                 if (this.logistic_number_return) {
-                    this.logistic_number_return= this.logistic_number_return;
                     this.checkLogisticNumberReturn();
                 }
             },
             watch: {
+                client_code:function(value){
+                    if(value== null || value === ''){
+                        this.order = {orderno: '', logstic_number: '', address: '', province: '', city: '', district: '', consignee_name: '', consignee_phone: '', carrierid: '', owner_id: '' , ownerName: '', order_id: ''};
+                    }
+                },
                 order_issue_type_id: {
                     handler: function (value) {
-                        if (value == null || value == '') {
+                        if (value == null || value === '') {
                             this.isSubmit = false;
                         }
                     },
                     immediate: true
                 },
-                order:function(value){
-                    if(value){
-
-                    }
-
-                },
-                logistic_number_return: {
-                    handler: function (value) {
-                        $("#wms_order_no").attr('disabled', !(value === ''));
-                        $("#logistic_number").attr('disabled', !(value === ''));
-                    },
-                    immediate: true
-                },
-                wms_order_no: {
-                    handler: function (value) {
-                        $("#logistic_number_return").attr('disabled', !(value === ''));
-                        $("#logistic_number").attr('disabled', !(value === ''));
-                    },
-                    immediate: true
-                },
                 secondOrder: function (order) {
                     if (order) {
                         this.second_order_id = order.id;
@@ -404,80 +342,86 @@
                         this.second_order_id = '';
                     }
                 },
-                rejectedBill:function(value){
-                    if(value){
+                rejectedBill: function (value) {
+                    if (value) {
                         this.logistic_number_return = value.logistic_number_return;
-                    }else{
+                    } else {
                         this.logistic_number_return = '';
                     }
+                },
+                logistic_number_return:function(value){
+                    if(!value){
+                        this.rejectedBill = '';
+                    }
                 }
             },
             methods: {
                 checkLogisticNumberReturn: function () {
-// 校验退回单号是否存在及是否存在退回单是否已有对应的问题件
-                    if (this.logistic_number_return == null || this.logistic_number_return == '') {
+                    if (this.logistic_number_return == null || this.logistic_number_return === '') {
                         return;
                     }
                     let _this = this;
-                    let data = {type: 'RejectedBill', id: this.logistic_number_return};
-                    axios.post("{{url('apiLocal/order/issue/orderIssueHasCreate')}}", data).then(function (res) {
+                    let data = {logisticNumberReturn: this.logistic_number_return};
+                    axios.post("{{url('apiLocal/order/issue/orderIssueHasLogisticNumberReturn')}}", data).then(function (res) {
                         if (res.data.success) {
-                            if (res.data.data.order) {
-                                _this.order = res.data.data.order;
+                            if (res.data.order) {
+                                _this.order = res.data.order;
+                            }
+                            if (res.data.rejectedBill) {
+                                _this.rejectedBill = res.data.rejectedBill;
                             }
-                            if (res.data.data.rejectedBill) {
-                                _this.rejectedBill = res.data.data.rejectedBill;
+                            if (res.data.meg) {
+                                tempTip.setDuration(3000);
+                                tempTip.showSuccess(res.data.meg);
                             }
                             _this.isSubmit = true;
                         } else {
                             tempTip.setDuration(3000);
                             tempTip.show(res.data.fail_info);
                             _this.isSubmit = false;
-
                         }
                     }).catch(function (err) {
                         tempTip.setDuration(5000);
                         tempTip.show('网络链接失败:' + err);
                         _this.isSubmit = false;
-
                     });
                 },
-                checkWMSOrderNo() {
-                    if (this.wms_order_no == '' || this.wms_order_no == null) {
+                checkClientCode() {
+                    if (this.client_code == null || this.client_code === '' ) {
+                        $('#logistic_number_return').attr('disabled', false);
                         return;
                     }
                     let _this = this;
-                    let data = {type: 'WMSOrderNo', id: this.wms_order_no};
-                    axios.post("{{url('apiLocal/order/issue/orderIssueHasCreate')}}", data).then(function (res) {
+                    let data = {clientCode: this.client_code};
+                    axios.post("{{url('apiLocal/order/issue/orderIssueHasClientCode')}}", data).then(function (res) {
                         if (res.data.success) {
-                            if (res.data.data.order) {
-                                _this.order = res.data.data.order;
+                            if (res.data.order) {
+                                _this.order = res.data.order;
                             }
-                            if (res.data.data.rejectedBill) {
-                                _this.rejectedBill = res.data.data.rejectedBill;
-                                if (res.data.data.rejectedBill.items) {
-                                    _this.rejectedBillItems = res.data.data.rejectedBill.items;
-                                }
+                            if (res.data.rejectedBill) {
+                                _this.rejectedBill = res.data.rejectedBill;
+                            } else {
+                                $('#logistic_number_return').attr('disabled', true);
                             }
                             _this.isSubmit = true;
                         } else {
                             tempTip.setDuration(3000);
                             tempTip.show(res.data.fail_info);
                             _this.isSubmit = false;
+                            $('#logistic_number_return').attr('disabled', false);
                         }
                     }).catch(function (err) {
                         tempTip.setDuration(5000);
                         tempTip.show('网络链接失败:' + err);
                         _this.isSubmit = false;
+                        $('#logistic_number_return').attr('disabled', false);
                     });
                 },
                 verifySecondOrder: function () {
-                    if (this.secondOrderNo == '' || this.secondOrderNo == null) {
-                        return;
-                    }
+                    if ( this.secondClientNO == null || this.secondClientNO === '' ) {return;}
                     let _this = this;
-                    let data = {type: 'WMSOrderNo', WMSOrderNo: this.secondOrderNo};
-                    axios.post("{{url('apiLocal/order/issue/getOrderInfoByWMSOrderNo')}}", data).then(function (res) {
+                    let data = {clientNo: this.secondClientNO};
+                    axios.post("{{url('apiLocal/order/issue/getOrderInfoByClientNo')}}", data).then(function (res) {
                         if (res.data.success) {
                             _this.secondOrder = res.data.data;
                             _this.isSubmit = true;
@@ -494,7 +438,5 @@
                 },
             }
         })
-
     </script>
-
 @endsection

+ 106 - 62
resources/views/order/issue/edit.blade.php

@@ -12,65 +12,78 @@
             <input type="hidden" name="rejected_bill_id" v-model="orderIssues.rejected_bill_id">
             <input type="hidden" name="order_issue_type_id" v-model="orderIssues.order_issue_type_id">
             <input type="hidden" name="second_order_id" v-model="orderIssues.second_order_id">
-
             <div class="card-body">
-{{--WMS订单号--}}
                 <div class="form-group row">
-                    <label for="name" class="col-2 col-form-label text-right">WMS订单号</label>
+                    <label for="name" class="col-2 col-form-label text-right">原始客户订单号</label>
                     <div class="col-8">
-                        <input type="text" class="form-control" name="name" v-model="order.code" disabled>
+                        <input type="text" class="form-control" name="client_code" v-model="order.client_code" disabled>
                     </div>
                 </div>
-{{--退回单号--}}
                 <div class="form-group row">
-                    <label class="col-2 col-form-label text-right">退回单号</label>
+                    <label class="col-2 col-form-label text-right">问题类别</label>
                     <div class="col-8">
-                        <input type="text" class="form-control" name="" v-model="rejectedBill.logistic_number_return"
-                               disabled>
+                        <select name="order_issue_type_id" class="form-control" id="order_issue_type_id" v-model="orderIssues.order_issue_type_id">
+                            <option value></option>
+                            <option v-for="type in orderIssueType" :value="type.id">@{{ type.name }}</option>
+                        </select>
                     </div>
                 </div>
-
-{{--处理状态--}}
                 <div class="form-group row">
-                    <label class="col-2 col-form-label text-right">处理状态</label>
+                    <label class="col-2 col-form-label text-right">客户</label>
                     <div class="col-8">
-                        <select name="handle_status" class="form-control" disabled v-model="orderIssues.handle_status">
-                            <option v-for="value in handleStatus" :value="value">@{{ value }}</option>
+                        <select name="owner_id" class="form-control" id="owner_id" v-model="order.owner_id">
+                            <option value></option>
+                            <option v-for="type in owners" :value="type.id">@{{ type.name }}</option>
                         </select>
                     </div>
                 </div>
-{{--问题类别--}}
                 <div class="form-group row">
-                    <label class="col-2 col-form-label text-right">问题类别</label>
+                    <label class="col-2 col-form-label text-right">承运商</label>
                     <div class="col-8">
-                        <select name="order_issue_type_id" class="form-control" id="order_issue_type_id"
-                                v-model="orderIssues.order_issue_type_id">
+                        <select name="logistic_id" class="form-control" id="logistic_id" v-model="order.logistic_id">
                             <option value></option>
-                            <option v-for="type in orderIssueType" :value="type.id">@{{ type.name }}</option>
+                            <option v-for="type in logistics" :value="type.id">@{{ type.name }}</option>
                         </select>
                     </div>
                 </div>
-{{--二次订单号--}}
                 <div class="form-group row">
-                    <label class="col-2 col-form-label text-right">二次订单号</label>
+                    <label class="col-2 col-form-label text-right">退回单号</label>
                     <div class="col-8">
-                        <input type="text" name="second_order_id" class="form-control" v-model="secondOrder.code" @blur="getSecondOrder($event)">
+                        <input type="text" class="form-control" name="logistic_number" v-model="rejectedBill.logistic_number_return" @blur="getRejectedBill" id="logistic_number_return">
                     </div>
                 </div>
-{{--二次运单号--}}
+                <div class="form-group row" >
+                    <label class="col-2 col-form-label text-right">退回单号客户</label>
+                    <div class="col-8 form-group">
+                        <select class="form-control" name="id_owner" v-model="rejectedBill.id_owner" id="id_owner">
+                            <option value></option>
+                            <option v-for="owner in owners" :value="owner.id">@{{ owner.name }}</option>
+                        </select>
+                    </div>
+                </div>
+                <div class="form-group row" >
+                    <label class="col-2 col-form-label text-right">退回单号承运商</label>
+                    <div class="col-8 form-group">
+                        <select class="form-control" name="id_logistic_return" v-model="rejectedBill.id_logistic_return" id="id_logistic_return">
+                            <option value></option>
+                            <option v-for="logistic in logistics" :value="logistic.id">@{{ logistic.name }}</option>
+                        </select>
+                    </div>
+                </div>
+
                 <div class="form-group row">
-                    <label class="col-2 col-form-label text-right">二次运单详情</label>
+                    <label class="col-2 col-form-label text-right">二次客户订单号</label>
                     <div class="col-8">
-                        <div class="alert alert-success" v-if="secondOrder.packages">
-                            订单详情已填充
-                        </div>
-                        <div class="alert alert-secondary" v-else>
-                            二次运单详情
-                        </div>
+                        <input type="text" name="second_order_id" class="form-control" v-model="secondOrder.client_code" @blur="getSecondOrder($event)" id="order_id">
+                    </div>
+                </div>
+                <div class="form-group row">
+                    <label class="col-2 col-form-label text-right">二次运单商品详情</label>
+                    <div class="col-8">
+                        <div class="alert alert-success" v-if="secondOrder.packages">二次运单商品详情已填充</div>
+                        <div class="alert alert-secondary" v-else>二次运单商品详情</div>
                         <table class="table" v-if="secondOrder.packages">
-                            <tr>
-                                <th>条码</th><th>商品名</th><th>数量</th>
-                            </tr>
+                            <tr><th>条码</th><th>商品名</th><th>数量</th></tr>
                             <template v-for="package in secondOrder.packages">
                                 <tr v-for="commodity in package.commodities">
                                     <td>@{{ commodity.commodity.sku }}</td>
@@ -81,14 +94,12 @@
                         </table>
                     </div>
                 </div>
-{{--最终状态--}}
                 <div class="form-group row">
-                    <label class="col-2 col-form-label text-right">处理结果说明</label>
+                    <label class="col-2 col-form-label text-right">处理结果</label>
                     <div class="col-8">
                         <textarea name="result_explain" class="form-control" v-model="orderIssues.result_explain"></textarea>
                     </div>
                 </div>
-{{--最终状态--}}
                 <div class="form-group row">
                     <label class="col-2 col-form-label text-right">最终状态</label>
                     <div class="col-8">
@@ -98,7 +109,6 @@
                         </select>
                     </div>
                 </div>
-{{--承运商赔偿金额--}}
                 <div class="form-group row">
                     <label class="col-2 col-form-label text-right">承运商赔偿金额</label>
                     <div class="col-8">
@@ -106,7 +116,6 @@
                                v-model="orderIssues.logistic_indemnity_money">
                     </div>
                 </div>
-{{--承运商快递减免--}}
                 <div class="form-group row">
                     <label class="col-2 col-form-label text-right">承运商快递减免</label>
                     <div class="col-8">
@@ -118,7 +127,6 @@
                         </select>
                     </div>
                 </div>
-{{--宝时赔偿金额--}}
                 <div class="form-group row">
                     <label class="col-2 col-form-label text-right">宝时赔偿金额</label>
                     <div class="col-8">
@@ -126,7 +134,6 @@
                                v-model="orderIssues.baoshi_indemnity_money">
                     </div>
                 </div>
-{{--宝时快递减免--}}
                 <div class="form-group row">
                     <label class="col-2 col-form-label text-right">宝时快递减免</label>
                     <div class="col-8">
@@ -138,7 +145,6 @@
                         </select>
                     </div>
                 </div>
-{{--事故责任方--}}
                 <div class="form-group row">
                     <label class="col-2 col-form-label text-right">事故责任方</label>
                     <div class="col-8">
@@ -149,7 +155,6 @@
                         </select>
                     </div>
                 </div>
-{{--提交--}}
                 <div class="form-group row">
                     <label class="col-2 col-form-label text-right"></label>
                     <div class="col-8">
@@ -158,15 +163,11 @@
                     </div>
                 </div>
             </div>
-{{--deleteOrderIssue--}}
             <div class="modal fade" id="alertModal" tabindex="-1" role="dialog"  aria-labelledby="alertModalLabel" aria-hidden="true">
                 <div class="modal-dialog  modal-dialog-centered">
                     <div class="modal-content">
                         <div class="modal-header">
                             <h5 class="modal-title" id="exampleModalLabel">提示</h5>
-{{--                            <button type="button" class="close" data-dismiss="modal" aria-label="Close" >--}}
-{{--                                <span aria-hidden="true">&times;</span>--}}
-{{--                            </button>--}}
                         </div>
                         <div class="modal-body">
                             <div class="alert alert-success">
@@ -189,9 +190,10 @@
             el: '#editOrderIssue',
             data: {
                 orderIssues: {!! $orderIssue!!},
-                order: {!! $order !!},
-                secondOrder: @if($secondOrder){!! $secondOrder !!}@else ''@endif,
-                rejectedBill: @if($rejectedBill){!! $rejectedBill !!}@else ''@endif,
+                order: @if($order){!! $order !!}@else {id:null,owner_id:null}@endif,
+                secondOrder: @if($secondOrder){!! $secondOrder !!}@else {client_code:''}@endif,
+                rejectedBill: @if($rejectedBill){!! $rejectedBill !!}@else {logistic_number_return:''}@endif,
+                create_RejectedBill:'',
                 owners:{!! $owners  !!},
                 logistics:{!! $logistics !!},
                 userWorkgroup: {!! $userWorkgroup !!},
@@ -201,27 +203,60 @@
                 final_status: ['已解决', '待退回', '退回中',],
                 logisticExpressRemission: ['原单减免', '部分减免', '全部减免'],
                 baoShiExpressRemission: ['原单减免', '部分减免', '全部减免'],
-                handleStatus: ['处理中', '已完结'],
+                logistic_number:@if($rejectedBill)'{!! $rejectedBill->logistic_number_return !!}'@else ''@endif
             },
             mounted: function () {
                 $("#editOrderIssue").removeClass('d-none');
-                console.log(this.secondOrder);
-
+                console.log(this.rejectedBill);
             },
             watch:{
                 secondOrder:{
                     handler:function(value){
                         if(value.code === ''){
                             this.secondOrder.packages = '';
-
                         }
                     },
                     deep:true,
                 },
             },
             methods: {
+                getRejectedBill(){
+                    let logistic_number_return =  this.rejectedBill.logistic_number_return;
+                    console.log(123,logistic_number_return);
+                    let _this = this;
+                    if( logistic_number_return === null || logistic_number_return == '' ){
+                        this.rejectedBill = {logistic_number_return:logistic_number_return} ;
+                        this.orderIssues.rejected_bill_id = null;
+                        return ;
+                    }
+                    let data = {logisticNumberReturn:logistic_number_return};
+                    axios.post("{{url('apiLocal/rejectedBill/getRejectedByLogisticNumberReturn')}}",data).then(function(res){
+                        if(res.data.success){
+                            if(res.data.rejectedBill){
+                                _this.rejectedBill = res.data.rejectedBill;
+                                _this.rejectedBill.id_logistic_return = res.data.rejectedBill.id_logistic_return;
+                                _this.rejectedBill.id_owner = res.data.rejectedBill.id_owner;
+                                _this.orderIssues.rejected_bill_id = res.data.rejectedBill.id;
+                            }
+                            if(res.data.msg){
+                                tempTip.setDuration(2000);
+                                tempTip.showSuccess(res.data.msg);
+                                _this.orderIssues.rejected_bill_id = null;
+                                _this.rejectedBill =  {logistic_number_return:logistic_number_return};
+                            }else {
+                                tempTip.setDuration(2000);
+                                tempTip.showSuccess('找到对应的问题单');
+                            }
+                        }else{
+                            tempTip.setDuration(4000);
+                            tempTip.show(res.data.fain_info);
+                        }
+                    }).catch(function(err){
+                        tempTip.setDuration(4000);
+                        tempTip.show('网络异常:' + err);
+                    });
+                },
                 orderIssueUpdate() {
-                    let data = this.orderIssues;
                     let arr = {
                         '问题类别':'order_issue_type_id',
                         '处理状态':'handle_status',
@@ -230,6 +265,15 @@
                         '承运商快递减免':'logistic_express_remission',
                         '宝时赔偿金额':'baoshi_indemnity_money',
                         '宝时快递减免':'baoshi_express_remission',
+                        '宝时快递减免':'baoshi_express_remission',
+                        '宝时快递减免':'baoshi_express_remission',
+                        '退回单号':'logistic_number_return',
+                        '退回单号货主':'id_owner',
+                        '退回单号承运商':'id_logistic_return',
+                    }
+                    let data = {orderIssues:this.orderIssues,order:this.order,rejectedBill:this.rejectedBill};
+                    if(data.rejectedBill.logistic_number_return == null || data.rejectedBill.logistic_number_return===''){
+                        data.rejectedBill = null;
                     }
                     axios.post('{{url("apiLocal/order/issue/update")}}', data).then(function (res) {
                         if (res.data.success) {
@@ -253,17 +297,18 @@
                 },
                 getSecondOrder(e){
                     let _this = this;
-                    let orderNo = $(e.target).val();
-                    if(!orderNo){
+                    let client_code = $(e.target).val();
+                    if(!client_code){
+                        _this.secondOrder = '';
+                        _this.orderIssues.second_order_id = null;
                         return ;
                     }
-                    if(orderNo){
-                        let data = {WMSOrderNo:orderNo};
-                        axios.post("{{url('apiLocal/order/issue/getOrderInfoByWMSOrderNo')}}",data).then(function(res){
+                    if(client_code){
+                        let data = {clientNo:client_code};
+                        axios.post("{{url('apiLocal/order/issue/getOrderInfoByClientNo')}}",data).then(function(res){
                             if(res.data.success){
                                 _this.secondOrder = res.data.data;
                                 _this.orderIssues.second_order_id = res.data.data.id;
-                                console.log(_this.orderIssues);
                             } else {
                                 tempTip.setDuration(4000);
                                 tempTip.show('查询订单信息出现异常:' + res.data.fail_info);
@@ -275,16 +320,15 @@
                     }
                 },
                 backOrderIssueIndex(){
-                    history.back();
-                    window.location.href = "{{url('order/issue/index')}}";
+                    window.location.href="javascript:history.go(-1)";
                 },
             }
         });
         $('.is-invalid').change(function(){
-            console.log(123);
             $(this).removeClass('is-invalid');
         })
 
+
     </script>
 
 @endsection

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

文件差异内容过多而无法显示
+ 455 - 290
resources/views/order/issue/index.blade.php


+ 2 - 2
resources/views/order/wave/search.blade.php

@@ -14,7 +14,7 @@
                 <tr>
                     <td colspan="20">
                         <button type="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="导出所有页将会以搜索条件得到的过滤结果,将其全部记录(每一页)导出">
+                                data-toggle="dropdown" title="导出所有页将会以搜索条件得到的筛选结果,将其全部记录(每一页)导出">
                             导出Excel
                         </button>
                         <div class="dropdown-menu">
@@ -82,7 +82,7 @@
 @endsection
 
 @section("lastScript")
-    <script type="text/javascript" src="{{asset('js/queryForm/queryForm200818a.js')}}"></script>
+    <script type="text/javascript" src="{{asset('js/queryForm/queryForm200825.js')}}"></script>
     <script>
         let vueList = new Vue({
             el: "#wave_div",

+ 1 - 1
resources/views/personnel/checking-in/missionAudit.blade.php

@@ -14,7 +14,7 @@
                     <tr v-if="isBeingFilterConditions">
                         <td colspan="4">
                             <div class="col" style="padding:0">
-                                <a  href="{{url('personnel/checking-in/missionAudit')}}"><span class="btn btn-warning text-dark">清除过滤条件</span></a>
+                                <a  href="{{url('personnel/checking-in/missionAudit')}}"><span class="btn btn-warning text-dark">清除筛选</span></a>
                             </div></td>
                         <td></td>
                     </tr>

+ 17 - 5
resources/views/personnel/laborReport/index.blade.php

@@ -10,7 +10,7 @@
         <div id="form_div"></div>
         <span class="dropdown">
                 <button class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget mt-1 mb-1" :class="[checkData.length>0?'btn-dark text-light':'']"
-                        data-toggle="dropdown" title="导出所有页将会以搜索条件得到的过滤结果,将其全部记录(每一页)导出">
+                        data-toggle="dropdown" title="导出所有页将会以搜索条件得到的筛选结果,将其全部记录(每一页)导出">
                     导出Excel
                 </button>
                 <div class="dropdown-menu">
@@ -76,7 +76,7 @@
                 <td><span v-if="laborReport.remark">@{{laborReport.remark}}</span></td>
             </tr>
         </table>
-        <table class="table table-striped table-bordered table-hover p-0 d-table  d-xl-none" style="background: rgb(255, 255, 255);">
+        <table id="listOnPad" class="table table-striped table-bordered table-hover p-0 d-table  d-xl-none" style="background: rgb(255, 255, 255);">
             <tr v-for="laborReport in laborReports">
                 <td style="filter:grayscale(30%);">
                     <div  class="pl-3 mt-1">
@@ -117,7 +117,7 @@
                             {{--                                    <span class="mr-3 text-nowrap"><span class="text-black">进场编号:</span><span style="color:#af7651">@{{ laborReport.enter_number }}</span></span>--}}
                             <span class="mr-3  text-nowrap"><span class="text-black">小组:</span><span class="text-black-50">@{{laborReport.userWorkGroupName  }}</span></span>
                             <span class="mr-3   text-nowrap"><span class="text-black">临时工:</span><span class="text-black-50">@{{ laborReport.name }} </span></span>
-                            {{--                                    <span class="mr-3 text-nowrap"><span class="text-black">电话:</span><span style="color:#af7651" v-if="">@{{ laborReport.mobile_phone }} </span></span>--}}
+                                                                <span class="mr-3 text-nowrap"><span class="text-black">电话:</span><span style="color:#af7651" v-if="">@{{ laborReport.mobile_phone }} </span></span>
                                                                 <span class="text-nowrap"><span class="text-black">身份证号:</span><span style="color:#af7651" v-if="">@{{ laborReport.identity_number }} </span></span>
                             {{--                                    <span class="mr-3 text-nowrap"><span class="text-black">劳务所:</span><span style="color:#af7651" v-if="">@{{ laborReport.labor_company }} </span></span>--}}
                             {{--                                    <span class="mr-3 text-nowrap"><span class="text-black">进组时间:</span><span style="color:#af7651" v-if="">@{{ laborReport.checkInAt }} </span></span>--}}
@@ -211,8 +211,8 @@
 
 @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 type="text/javascript" src="{{asset('js/queryForm/queryForm200825.js')}}"></script>
+    <script type="text/javascript" src="{{asset('js/queryForm/header200826b.js')}}"></script>
     <script>
         let today=(new Date());
         function isTomorrow(){
@@ -230,6 +230,18 @@
         setInterval(reloadOnTomorrow,1000*60*60)
     </script>
     <script>
+        let hideHeaderTitle = function (){
+            let $listOnPad = $('#listOnPad');
+            let $headerRoll = $('#headerRoll');
+            if($listOnPad.css('display')!=='none'){
+                $headerRoll.attr('hidden',true)
+            }else{
+                $headerRoll.attr('hidden',false)
+                $headerRoll.find('tr').css('width',$(document).width());
+            }
+        };
+        window.onresize= hideHeaderTitle;
+        window.onscroll=hideHeaderTitle;
         @if(isset($request))
         let request={!! json_encode($request) !!};
         @endif

+ 3 - 3
resources/views/process/index.blade.php

@@ -9,7 +9,7 @@
             <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="导出所有页将会以搜索条件得到的过滤结果,将其全部记录(每一页)导出">
+                    data-toggle="dropdown" title="导出所有页将会以搜索条件得到的筛选结果,将其全部记录(每一页)导出">
                 导出Excel
             </button>
             <div class="dropdown-menu">
@@ -462,8 +462,8 @@
 
 @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 type="text/javascript" src="{{asset('js/queryForm/queryForm200825.js')}}"></script>
+    <script type="text/javascript" src="{{asset('js/queryForm/header200826b.js')}}"></script>
     <script>
         let vue = new Vue({
             el:"#process",

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

@@ -12,7 +12,7 @@
                     <table class="table  table-sm table-bordered text-nowrap  mb-0">
                         <tr v-if="isBeingFilterConditions">
                             <td colspan="10"><div class="col" style="padding:0" >
-                                    <a  href="{{url('process/statistic')}}"><span class="btn btn-warning text-dark">清除过滤条件</span></a>
+                                    <a  href="{{url('process/statistic')}}"><span class="btn btn-warning text-dark">清除筛选</span></a>
                                 </div></td>
                         </tr>
                         <tr>
@@ -75,7 +75,7 @@
                             <td colspan="3">
                                 <span class="dropdown">
                                     <button class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget"
-                                    data-toggle="dropdown" title="导出所有页将会以搜索条件得到的过滤结果,将其全部记录(每一页)导出">
+                                    data-toggle="dropdown" title="导出所有页将会以搜索条件得到的筛选结果,将其全部记录(每一页)导出">
                                         导出Excel
                                     </button>
                                     <div class="dropdown-menu">

+ 2 - 2
resources/views/rejected/recycle.blade.php

@@ -18,7 +18,7 @@
                                 <div class="row">
                                     <div class="col" v-if="isBeingFilterConditions">
                                         <label for="">
-                                            <a :href="'{{url('rejected').'?paginate='}}'+filterParams.paginate"><span class="btn btn-warning text-dark">清除过滤条件</span></a>
+                                            <a :href="'{{url('rejected').'?paginate='}}'+filterParams.paginate"><span class="btn btn-warning text-dark">清除筛选</span></a>
                                         </label>
                                     </div>
                                     <table class="table mb-n3 table-sm table-bordered">
@@ -39,7 +39,7 @@
                                             <td width="80%"></td>
                                         </tr>
 {{--                                        <tr>--}}
-{{--                                            <td class="text-muted">按条件过滤:</td>--}}
+{{--                                            <td class="text-muted">按条件筛选:</td>--}}
 {{--                                            <td colspan="2">--}}
 {{--                                                <label for="">时间:</label>--}}
 {{--                                                <input type="date" name="created_at_start" class="form-control-sm tooltipTarget" style="width:140px"--}}

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

@@ -12,7 +12,7 @@
             <button
                     class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget"
                     :class="[rejectedBills_checkBoxes.length>0?'btn-dark text-light':'']"
-                    data-toggle="dropdown" title="导出所有页将会以搜索条件得到的过滤结果,将其全部记录(每一页)导出">
+                    data-toggle="dropdown" title="导出所有页将会以搜索条件得到的筛选结果,将其全部记录(每一页)导出">
                 导出Excel
             </button>
             <div class="dropdown-menu">
@@ -61,7 +61,7 @@
 
 @section('lastScript')
     <script src="{{asset('js/queryForm/export200818a.js')}}"></script>
-    <script src="{{asset('js/queryForm/queryForm200803a.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({

+ 3 - 3
resources/views/rejected/search/general.blade.php

@@ -15,7 +15,7 @@
                 @endif                <div id="form_div"></div>
                 <span class="dropdown">
                     <button class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget":class="[rejectedBills_checkBoxes.length>0?'btn-dark text-light':'']"
-                            data-toggle="dropdown" title="导出所有页将会以搜索条件得到的过滤结果,将其全部记录(每一页)导出">
+                            data-toggle="dropdown" title="导出所有页将会以搜索条件得到的筛选结果,将其全部记录(每一页)导出">
                         导出Excel
                     </button>
                     <div class="dropdown-menu">
@@ -176,8 +176,8 @@
         let csrfInput='@csrf';
     </script>
     <script src="{{asset('js/queryForm/export200818a.js')}}"></script>
-    <script src="{{asset('js/queryForm/queryForm200818a.js')}}"></script>
-    <script type="text/javascript" src="{{asset('js/queryForm/header200819.js')}}"></script>
+    <script src="{{asset('js/queryForm/queryForm200825.js')}}"></script>
+    <script type="text/javascript" src="{{asset('js/queryForm/header200826b.js')}}"></script>
     <script>
         let vue = new Vue({
             el:"#list",

+ 1 - 1
resources/views/store/index.blade.php

@@ -34,7 +34,7 @@
 @endsection
 
 @section('lastScript')
-    <script type="text/javascript" src="{{asset('js/queryForm/header200819.js')}}"></script>
+    <script type="text/javascript" src="{{asset('js/queryForm/header200826b.js')}}"></script>
     <script>
         let vue = new Vue({
             el:'#fast',

+ 1 - 1
resources/views/store/storeItem/index.blade.php

@@ -38,7 +38,7 @@
 @endsection
 
 @section('lastScript')
-    <script type="text/javascript" src="{{asset('js/queryForm/header200819.js')}}"></script>
+    <script type="text/javascript" src="{{asset('js/queryForm/header200826b.js')}}"></script>
     <script>
         let vue = new Vue({
             el:'#item',

+ 3 - 3
resources/views/waybill/delivering.blade.php

@@ -8,7 +8,7 @@
             <div class="text-nowrap mb-0" style="background: #fff;">
                 <div v-if="isBeingFilterConditions">
                     <div><div class="col" style="padding:0">
-                            <a  href="{{url('waybill/delivering')}}"><span class="btn btn-warning text-dark">清除过滤条件</span></a>
+                            <a  href="{{url('waybill/delivering')}}"><span class="btn btn-warning text-dark">清除筛选</span></a>
                         </div>
                     </div>
                 </div>
@@ -32,7 +32,7 @@
                 <div class="ml-4 mt-2">
                     <span class="dropdown">
                         <button type="button" class="btn  btn-sm  form-control-sm dropdown-toggle tooltipTarget" :class="[checkData.length>0?'btn-dark text-light':'btn-outline-dark']"
-                                data-toggle="dropdown" title="导出所有页将会以搜索条件得到的过滤结果,将其全部记录(每一页)导出">
+                                data-toggle="dropdown" title="导出所有页将会以搜索条件得到的筛选结果,将其全部记录(每一页)导出">
                             导出Excel
                         </button>
                         <div class="dropdown-menu">
@@ -187,7 +187,7 @@
     .color1{background-color: #FFA07A}
     .color2{background-color: cornflowerblue}
 </style>
-<script type="text/javascript" src="{{asset('js/queryForm/header200819.js')}}"></script>
+<script type="text/javascript" src="{{asset('js/queryForm/header200826b.js')}}"></script>
 <script>
     new Vue({
         el:"#list",

+ 3 - 3
resources/views/waybill/index.blade.php

@@ -29,7 +29,7 @@
             <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="导出所有页将会以搜索条件得到的过滤结果,将其全部记录(每一页)导出">
+                        data-toggle="dropdown" title="导出所有页将会以搜索条件得到的筛选结果,将其全部记录(每一页)导出">
                     导出Excel
                 </button>
                 <div class="dropdown-menu">
@@ -334,8 +334,8 @@
         }
     </style>
     <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 type="text/javascript" src="{{asset('js/queryForm/queryForm200825.js')}}"></script>
+    <script type="text/javascript" src="{{asset('js/queryForm/header200826b.js')}}"></script>
     <script>
         let vue = new Vue({
             el:'#list',

+ 2 - 2
resources/views/waybill/waybillFinancialSnapshot/index.blade.php

@@ -45,7 +45,7 @@
     <label>操作选定记录:</label>
         <span class="dropdown">
             <button class="btn btn-sm form-control-sm dropdown-toggle tooltipTarget" :class="[checkData.length>0?'btn-dark':'btn-outline-dark']"
-                    data-toggle="dropdown" title="导出所有页将会以搜索条件得到的过滤结果,将其全部记录(每一页)导出">
+                    data-toggle="dropdown" title="导出所有页将会以搜索条件得到的筛选结果,将其全部记录(每一页)导出">
                 导出Excel
             </button>
             <div class="dropdown-menu">
@@ -133,7 +133,7 @@
 @stop
 
 @section('lastScript')
-<script type="text/javascript" src="{{asset('js/queryForm/header200819.js')}}"></script>
+<script type="text/javascript" src="{{asset('js/queryForm/header200826b.js')}}"></script>
 <script>
     let vue = new Vue({
         el:'#editingPanel',

+ 3 - 3
resources/views/weight/package/index.blade.php

@@ -12,7 +12,7 @@
             <div id="form_div"></div>
             <span class="dropdown">
                 <button class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget mt-1 mb-1" :class="[checkData.length>0?'btn-dark text-light':'']"
-                        data-toggle="dropdown" title="导出所有页将会以搜索条件得到的过滤结果,将其全部记录(每一页)导出">
+                        data-toggle="dropdown" title="导出所有页将会以搜索条件得到的筛选结果,将其全部记录(每一页)导出">
                     导出Excel
                 </button>
                 <div class="dropdown-menu">
@@ -58,8 +58,8 @@
 
 @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 type="text/javascript" src="{{asset('js/queryForm/queryForm200825.js')}}"></script>
+    <script type="text/javascript" src="{{asset('js/queryForm/header200826b.js')}}"></script>
     <script>
             @if(isset($request))
         let request={!! json_encode($request) !!};

+ 2 - 2
resources/views/weight/package/statistics.blade.php

@@ -13,7 +13,7 @@
                         <table class="table  table-sm table-bordered text-nowrap  mb-0">
                             <tr v-if="isBeingFilterConditions">
                                 <td colspan="10"><div class="col" style="padding:0">
-                                        <a  href="{{url('package/statistics')}}"><span class="btn btn-warning text-dark">清除过滤条件</span></a>
+                                        <a  href="{{url('package/statistics')}}"><span class="btn btn-warning text-dark">清除筛选</span></a>
                                     </div></td>
                             </tr>
                             <tr >
@@ -101,7 +101,7 @@
                                 <td colspan="3">
                                     <span class="dropdown">
                                         <button class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget" {{--:class="[rejectedBills_checkBoxes.length>0?'btn-dark text-light':'']"--}}
-                                        data-toggle="dropdown" title="导出所有页将会以搜索条件得到的过滤结果,将其全部记录(每一页)导出">
+                                        data-toggle="dropdown" title="导出所有页将会以搜索条件得到的筛选结果,将其全部记录(每一页)导出">
                                             导出Excel
                                         </button>
                                         <div class="dropdown-menu">

+ 2 - 2
resources/views/weight/weightExcepted/index.blade.php

@@ -28,7 +28,7 @@
                                     <label style="margin-left: 5px"> 操作选定记录:</label>
                                     <span class="dropdown">
                                         <button class="btn btn-sm form-control-sm dropdown-toggle tooltipTarget" :class="[checkData.length>0?'btn-dark':'btn-outline-dark']"
-                                                data-toggle="dropdown" title="导出所有页将会以搜索条件得到的过滤结果,将其全部记录(每一页)导出">
+                                                data-toggle="dropdown" title="导出所有页将会以搜索条件得到的筛选结果,将其全部记录(每一页)导出">
                                             导出Excel
                                         </button>
                                         <div class="dropdown-menu">
@@ -86,7 +86,7 @@
 @endsection
 
 @section('lastScript')
-    <script type="text/javascript" src="{{asset('js/queryForm/header200819.js')}}"></script>
+    <script type="text/javascript" src="{{asset('js/queryForm/header200826b.js')}}"></script>
     <script>
         let vue = new Vue({
             el:"#list",

+ 14 - 13
routes/apiLocal.php

@@ -29,17 +29,18 @@ Route::post('waybill/recoverSelected', 'WaybillController@apiRestoreSelected');
 Route::post('waybill/changeFee', 'WaybillController@changeFee');
 Route::post('waybill/changeCharge', 'WaybillController@changeCharge');
 
-Route::post('rejectedBill/getRejectedByLogisticNumberReturn','RejectedBillItemController@apiGetRejectedByLogisticNumberReturn');
-Route::group(['prefix'=>'order'],function(){
-    Route::post('issue/onTop/store','OrderIssueOnTopController@apiStore');
-    Route::post('issue/onTop/cancelTop','OrderIssueOnTopController@apiDestroy');
-    Route::post('issue/update','OrderIssueController@apiUpdate');
-    Route::post('issue/destroy','OrderIssueController@apiDestroy');
-    Route::post('issue/orderIssueTag','OrderIssueController@apiOrderIssueTag');
-    Route::post('issue/log/store','OrderIssueProcessLogController@apiStore');
-    Route::post('issue/log/destroy','OrderIssueProcessLogController@apisDestroy');
-    Route::post('issue/disposeOrderIssue','OrderIssueController@apiDisposeOrderIssue');
-    Route::post('issue/endOrderIssue','OrderIssueController@apiEndOrderIssue');
-    Route::post('issue/orderIssueHasCreate','OrderIssueController@apiOrderIssueHasCreate');
-    Route::post('issue/getOrderInfoByWMSOrderNo','OrderIssueController@apiGetOrderInfoByWMSOrderNo');
+Route::post('rejectedBill/getRejectedByLogisticNumberReturn','RejectedController@apiGetRejectedByLogisticNumberReturn');
+Route::group(['prefix' => 'order'], function () {
+    Route::post('issue/onTop/store', 'OrderIssueOnTopController@apiStore');
+    Route::post('issue/onTop/cancelTop', 'OrderIssueOnTopController@apiDestroy');
+    Route::post('issue/orderIssueHasClientCode', 'OrderIssueController@apiOrderIssueHasClientCode');
+    Route::post('issue/orderIssueHasLogisticNumberReturn', 'OrderIssueController@apiOrderIssueHasLogisticNumberReturn');
+    Route::post('issue/update', 'OrderIssueController@apiUpdate');
+    Route::post('issue/destroy', 'OrderIssueController@apiDestroy');
+    Route::post('issue/orderIssueTag', 'OrderIssueController@apiOrderIssueTag');
+    Route::post('issue/log/store', 'OrderIssueProcessLogController@apiStore');
+    Route::post('issue/log/destroy', 'OrderIssueProcessLogController@apiDestroy');
+    Route::post('issue/disposeOrderIssue', 'OrderIssueController@apiDisposeOrderIssue');
+    Route::post('issue/endOrderIssue', 'OrderIssueController@apiEndOrderIssue');
+    Route::post('issue/getOrderInfoByClientNo', 'OrderIssueController@apiGetOrderInfoByClientNo');
 });

+ 16 - 3
routes/web.php

@@ -299,13 +299,26 @@ 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::post('stockInventory/createStockInventoryMission','InventoryController@createStockInventoryMission');
-    Route::any('stockInventory/enterStockInventory/{id}','InventoryController@enterStockInventory');
+    Route::get('stockInventory/mission','InventoryAccountController@mission');
+    //创建盘点任务
+    Route::post('stockInventory/createStockInventoryMission','InventoryAccountController@createStockInventoryMission');
+    //删除盘点任务
+    Route::any('deleteStockInventoryMission/{id}','InventoryAccountController@deleteStockInventoryMission');
+    //进入盘点或者复盘页面
+    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','InventoryAccountController@searchStockInventoryRecord');
+
+
 });
 
 /**

+ 21 - 0
tests/Inventory/ExampleTest.php

@@ -0,0 +1,21 @@
+<?php
+
+namespace Tests\Unit;
+
+use App\Authority;
+use App\Carrier;
+use App\Role;
+use App\User;
+use Illuminate\Support\Facades\DB;
+use Tests\TestCase;
+use Illuminate\Foundation\Testing\WithFaker;
+use Illuminate\Foundation\Testing\RefreshDatabase;
+
+class ExampleTest extends TestCase
+{
+
+    public function testExample(){
+        $this->assertEquals(2,1+1);
+    }
+
+}

+ 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);
+    }
+
+}
+

+ 118 - 0
tests/Inventory/Services/InventoryAccountService/InventoryAccountService_CreateInventoryMissionRecordTest.php

@@ -0,0 +1,118 @@
+<?php
+
+
+namespace Tests\Inventory\Services\InventoryAccountService;
+
+
+use App\InventoryAccount;
+use App\InventoryAccountMission;
+use App\Services\InventoryAccountService;
+use Tests\TestCase;
+
+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(InventoryAccount::class)->create();
+        $this->realService=new InventoryAccountService();
+        $this->wmsInventoryAccounts=$this->realService->conditionPortStock('2020-08-20','2020-08-20',3);
+    }
+        function testCreateInventoryMissionsFail(){
+        $inventoryMissions= $this->realService->createInventoryAccountMissionRecord('',$this->inventory['id'],$this->wmsInventoryAccounts);
+        $this->assertNull($inventoryMissions);
+    }
+    function testCreateInventoryMissionsSuccess(){
+        $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
+    {
+        InventoryAccountMission::where('inventory_account_id',$this->inventory['id'])->delete();
+        InventoryAccount::where('id',$this->inventory['id'])->forceDelete();
+        parent::tearDown(); // TODO: Change the autogenerated stub
+    }
+
+
+}
+
+
+//function testMock(){
+//    $realService=new InventoryService();
+//    $mockService=$this->createMock(InventoryService=>=>class);
+//    $mockService->method('conditionSearch')->willReturn(new Collection(['a'=>'11','b'=>22]));
+//    $mockService->method('createInventoryMissionRecord')->willReturn($realService->createInventoryMissionRecord(11,22,33));
+//    $this->assertEquals(2,$mockService->createInventoryMissionRecord());
+//}
+//$array=[
+//    0 => [
+//        "货主"=>"金宝贝",
+//        "客户"=> "JINBAOBEI",
+//        "库位"=> "G08-05-01",
+//        "产品编码"=> "900317006-ORANGE",
+//        "产品条码"=> "240041417",
+//        "商品名称"=> "麦克风橙色",
+//        "属性仓"=> "JBB-ZP",
+//        "质量状态"=> "ZP",
+//        "失效日期"=> null,
+//        "批号"=> null,
+//        "生产日期"=> null,
+//        "入库日期"=> null,
+//        "移出数量"=> "3",
+//        "移入数量"=> "0",
+//        "在库数量"=> "745",
+//        "占用数量"=> "0",
+//        "sum"=> "6954",
+//        "rn"=> "1",
+//    ],
+//    1 => [
+//        "货主"=> "金宝贝",
+//        "客户"=> "JINBAOBEI",
+//        "库位"=> "G05-20-03",
+//        "产品编码"=> "8809465536572",
+//        "产品条码"=> "8809465536572",
+//        "商品名称"=> "STICK-O益智磁力片金宝核心套组",
+//        "属性仓"=> "JBB-ZP",
+//        "质量状态"=> "ZP",
+//        "失效日期"=> null,
+//        "批号"=> null,
+//        "生产日期"=> null,
+//        "入库日期"=> null,
+//        "移出数量"=> "22",
+//        "移入数量"=> "0",
+//        "在库数量"=> "98",
+//        "占用数量"=> "5",
+//        "sum"=> "6954",
+//        "rn"=> "2",
+//    ],
+//    2 => [
+//        "货主"=> "金宝贝",
+//        "客户"=> "JINBAOBEI",
+//        "库位"=> "G08-28-01",
+//        "产品编码"=> "6972392150141",
+//        "产品条码"=> "6972392150141",
+//        "商品名称"=> "皆蓝迪雅婴儿泡沫免洗洗手液 50ml",
+//        "属性仓"=> null,
+//        "质量状态"=> "ZP",
+//        "失效日期"=> "2023-04-19",
+//        "批号"=> "20DZK1Y01",
+//        "生产日期"=> null,
+//        "入库日期"=> null,
+//        "移出数量"=> "0",
+//        "移入数量"=> "10000",
+//        "在库数量"=> null,
+//        "占用数量"=> null,
+//        "sum"=> "6954",
+//        "rn"=> "3",
+//    ],
+//];
+
+
+
+

+ 45 - 0
tests/Inventory/Services/InventoryAccountService/InventoryAccountService_CreateMissionTest.php

@@ -0,0 +1,45 @@
+<?php
+
+
+namespace Tests\Inventory\Services\InventoryAccountService;
+
+
+use App\InventoryAccount;
+use App\InventoryAccountMission;
+use App\Services\InventoryAccountService;
+use Tests\TestCase;
+
+class InventoryAccountService_CreateMissionTest extends TestCase
+{
+
+    public $inventory;
+    public $inventoryMissions;
+    function setUp(): void
+    {
+        parent::setUp(); // TODO: Change the autogenerated stub
+    }
+        function testCreateMissionsFail(){
+        $realService=new InventoryAccountService();
+        $this->inventory=$realService->createMission('2020-08-20','2020-08-20','');
+        $this->assertNull($this->inventory);
+    }
+    function testCreateMissionsSuccess(){
+        $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
+    {
+        InventoryAccountMission::where('inventory_account_id',$this->inventory['id'])->delete();
+        InventoryAccount::where('id',$this->inventory['id'])->forceDelete();
+        parent::tearDown(); // TODO: Change the autogenerated stub
+    }
+
+
+}
+
+
+
+
+

+ 24 - 0
tests/Inventory/Services/InventoryAccountService/InventoryAccountService_GetTest.php

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

+ 39 - 0
tests/Inventory/Services/InventoryAccountService/InventoryAccountService_PaginateTest.php

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

+ 73 - 0
tests/Inventory/Services/InventoryAccountService/InventoryAccountService_SearchStockInventoryRecordTest.php

@@ -0,0 +1,73 @@
+<?php
+
+
+namespace Tests\Inventory\Services\InventoryAccountService;
+
+
+use App\Commodity;
+use App\CommodityBarcode;
+use App\InventoryAccount;
+use App\InventoryAccountMission;
+use App\Services\InventoryAccountService;
+use Tests\TestCase;
+
+class InventoryServiceSearchStockInventoryRecordTest extends TestCase
+{
+    public $inventory;
+    public $inventoryMission;
+    public $commodity;
+    public $commodityBarcode;
+    function setUp(): void
+    {
+        parent::setUp(); // TODO: Change the autogenerated stub
+        $this->commodity=Commodity::create([
+            'name'=>'棒棒糖',
+            'sku'=>'525252525252525',
+            'owner'=>3,
+        ]);
+        $this->commodityBarcode=CommodityBarcode::create([
+            'code'=>'89898989',
+            'commodity_id'=>$this->commodity['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,
+            'valid_at'=>null,
+            'stored_at'=>null,
+            'batch_number'=>'',
+            'erp_type_position'=>'',
+            'quality'=>'',
+            'stored_amount'=>50,
+            'valid_amount'=>'',
+            'verified_amount'=>null,
+            're_checked_amount'=>'',
+            'difference_amount'=>null,
+            'occupied_amount'=>'',
+            'checked'=>'否',
+            'returned'=>'无',
+        ]);
+    }
+    function testSearchStockInventoryNotEmpty(){
+        $inventoryService=new InventoryAccountService();
+        $inventoryMission=$inventoryService->searchStockInventoryRecord('A21-02-02','89898989',$this->inventory['id']);
+        $this->assertNotEmpty($inventoryMission);
+    }
+    function testSearchStockInventoryEmpty(){
+        $inventoryService=new InventoryAccountService();
+        $inventoryMission=$inventoryService->searchStockInventoryRecord('','',$this->inventory['id']);
+        $this->assertEmpty($inventoryMission);
+    }
+
+    function tearDown(): void
+    {
+        CommodityBarcode::where('commodity_id',$this->commodity['id'])->delete();
+        Commodity::where('id',$this->commodity['id'])->delete();
+        InventoryAccountMission::where('inventory_account_id',$this->inventory['id'])->delete();
+        InventoryAccount::where('id',$this->inventory['id'])->forceDelete();
+        parent::tearDown(); // TODO: Change the autogenerated stub
+    }
+}
+

+ 45 - 0
tests/Inventory/Services/InventoryAccountService/InventoryAccountService_SomeTest.php

@@ -0,0 +1,45 @@
+<?php
+
+
+namespace Tests\Inventory\Services\InventoryAccountService;
+
+
+use App\InventoryAccount;
+use App\Services\InventoryAccountService;
+use Tests\TestCase;
+
+class InventoryAccountService_SomeTest extends TestCase
+{
+    public $inventories;
+    public $inventorys;
+    public $queryParam=[];
+    public $first;
+    public $second;
+    function setUp(): void
+    {
+        parent::setUp(); // TODO: Change the autogenerated stub
+        $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 InventoryAccountService();
+        $this->inventories=$inventoryService->some($this->queryParam);
+        $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
+    {
+        InventoryAccount::where('id',$this->first['id'])->forceDelete();
+        InventoryAccount::where('id',$this->second['id'])->forceDelete();
+        parent::tearDown(); // TODO: Change the autogenerated stub
+    }
+
+
+}
+

+ 70 - 0
tests/Inventory/Services/InventoryAccountService/InventoryAccountService_StockInventoryTest.php

@@ -0,0 +1,70 @@
+<?php
+
+
+namespace Tests\Inventory\Services\InventoryAccountService;
+
+
+use App\Commodity;
+use App\CommodityBarcode;
+use App\InventoryAccount;
+use App\InventoryAccountMission;
+use App\Services\InventoryAccountService;
+use Tests\TestCase;
+
+class InventoryServiceStockInventoryTest extends TestCase
+{
+    public $inventory;
+    public $inventoryMission;
+    public $commodity;
+    public $commodityBarcode;
+    function setUp(): void
+    {
+        parent::setUp(); // TODO: Change the autogenerated stub
+        $this->commodity=Commodity::create([
+            'name'=>'如意精箍棒',
+            'sku'=>'525252525252525',
+            'owner'=>3,
+        ]);
+        $this->commodityBarcode=CommodityBarcode::create([
+            'code'=>'89898989',
+            'commodity_id'=>$this->commodity['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,
+            'valid_at'=>null,
+            'stored_at'=>null,
+            'batch_number'=>'',
+            'erp_type_position'=>'',
+            'quality'=>'',
+            'stored_amount'=>50,
+            'valid_amount'=>'',
+            'verified_amount'=>null,
+            're_checked_amount'=>'',
+            'difference_amount'=>null,
+            'occupied_amount'=>'',
+            'checked'=>'否',
+            'returned'=>'无',
+        ]);
+    }
+    function testStockInventoryNoDifferenceAndStockSuccess(){
+        $inventoryService=new InventoryAccountService();
+        $inventoryMission=$inventoryService->stockInventory('A21-02-02','89898989','50',$this->inventory['id']);
+        $this->assertEquals('是',$inventoryMission['checked']);
+        $this->assertEquals(0,$inventoryMission['difference_amount']);
+        $this->assertEquals(50,$inventoryMission['verified_amount']);
+    }
+
+    function tearDown(): void
+    {
+        CommodityBarcode::where('commodity_id',$this->commodity['id'])->delete();
+        Commodity::where('id',$this->commodity['id'])->delete();
+        InventoryAccountMission::where('inventory_account_id',$this->inventory['id'])->delete();
+        InventoryAccount::where('id',$this->inventory['id'])->forceDelete();
+        parent::tearDown(); // TODO: Change the autogenerated stub
+    }
+}
+

+ 60 - 0
tests/Inventory/http/InventoryAccountControllor/InventoryAccountController_CreateStockInventoryMissionTest.php

@@ -0,0 +1,60 @@
+<?php
+
+
+namespace Tests\Inventory\Http\InventoryController;
+
+
+use App\Authority;
+use App\InventoryAccount;
+use App\InventoryAccountMission;
+use App\Role;
+use App\User;
+use Illuminate\Support\Facades\DB;
+use Tests\TestCase;
+
+class InventoryAccountController_CreateStockInventoryMissionTest extends TestCase
+{
+    public $response=null;
+    public $role;
+    public $user;
+    public $inventory;
+    function setUp(): void
+    {
+        parent::setUp(); // TODO: Change the autogenerated stub
+        if(!$this->user){
+            $this->user = factory(User::class)->create();
+            $this->role= Role::firstOrCreate([
+                'name'=>'testRole',
+            ]);
+            $this->assertNotEmpty($this->role->id);
+            $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->response=$this->actingAs($this->user)->json('post','http://bswas/inventory/stockInventory/createStockInventoryMission/',
+            [
+                'date_end'=>'2020-08-17',
+                'date_start'=>'2020-08-17',
+                'owner_id'=>3,
+            ]);
+    }
+    function testCreateStockInventoryMissionNotHavingException(){
+        $this->response->assertDontSee('Exception');
+    }
+    function testCreateStockInventoryMissionStatusCode(){
+        $this->response->assertStatus(200);
+    }
+    function testCreateStockInventoryMissionSuccessJson(){
+        $this->response->assertJson(['success'=>true,'data'=>$this->response->json()['data']]);
+    }
+    function tearDown(): void
+    {
+        DB::table('user_role')->where('id_role',$this->role['id'])->delete();
+        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();
+        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
+    }
+}

+ 53 - 0
tests/Inventory/http/InventoryAccountControllor/InventoryAccountController_DeleteStockInventoryMissionTest.php

@@ -0,0 +1,53 @@
+<?php
+
+
+namespace Tests\Inventory\Http\InventoryController;
+
+
+use App\Authority;
+use App\InventoryAccount;
+use App\Owner;
+use App\Role;
+use App\User;
+use Illuminate\Support\Facades\DB;
+use Tests\TestCase;
+
+class InventoryControllerDeleteStockInventoryMissionTestMissionTest extends TestCase
+{
+    public $response=null;
+    public $role;
+    public $user;
+    public $inventory;
+    function setUp(): void
+    {
+        parent::setUp(); // TODO: Change the autogenerated stub
+        if(!$this->user){
+            $this->user = factory(User::class)->create();
+            $this->role= Role::firstOrCreate([
+                'name'=>'testRole',
+            ]);
+            $this->assertNotEmpty($this->role->id);
+            $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(InventoryAccount::class)->create();
+        }
+        $this->response=$this->actingAs($this->user)->json('delete','http://bswas/inventory/deleteStockInventoryMission/'.$this->inventory['id']);
+    }
+
+    function testDeleteStockInventoryMissionNotHavingException(){
+        $this->response->assertDontSee('Exception');
+    }
+    function testDeleteStockInventoryMissionHasSuccessJson(){
+        $this->response->assertJson(['success'=>true,]);
+    }
+    function tearDown(): void
+    {
+        DB::table('user_role')->where('id_role',$this->role['id'])->delete();
+        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();
+        InventoryAccount::where('id',$this->inventory['id'])->forceDelete();
+        parent::tearDown(); // TODO: Change the autogenerated stub
+    }
+}

+ 91 - 0
tests/Inventory/http/InventoryAccountControllor/InventoryAccountController_EnterStockInventoryTest.php

@@ -0,0 +1,91 @@
+<?php
+
+
+namespace Tests\Inventory\Http\InventoryController;
+
+
+use App\Authority;
+use App\Commodity;
+use App\InventoryAccount;
+use App\InventoryAccountMission;
+use App\Owner;
+use App\Role;
+use App\Services\InventoryAccountService;
+use App\Services\UnitService;
+use App\User;
+use Illuminate\Database\Eloquent\Collection;
+use Illuminate\Support\Facades\DB;
+use Illuminate\Support\Str;
+use Tests\TestCase;
+
+class InventoryControllerEnterStockInventoryMissionTestTest extends TestCase
+{
+    public $response=null;
+    public $role;
+    public $user;
+    public $inventory;
+    public $inventoryMissions;
+    function setUp(): void
+    {
+        parent::setUp(); // TODO: Change the autogenerated stub
+        if(!$this->user){
+            $this->user = factory(User::class)->create();
+            $this->role= Role::firstOrCreate([
+                'name'=>'testRole',
+            ]);
+            $this->assertNotEmpty($this->role->id);
+            $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(InventoryAccount::class)->create();
+            $total=$this->inventory['total'];
+            for ($i=0;$i<$total;$i++){
+                $this->inventoryMissions=InventoryAccountMission::create([
+                    'inventory_account_id'=>$this->inventory['id'],
+                    'location'=>Str::random(5),
+                    'commodity_id'=>256226,
+                    'produced_at'=>null,
+                    'valid_at'=>null,
+                    'stored_at'=>null,
+                    'batch_number'=>'',
+                    'erp_type_position'=>'',
+                    'quality'=>'',
+                    'stored_amount'=>50,
+                    'valid_amount'=>'',
+                    'verified_amount'=>'',
+                    're_checked_amount'=>'',
+                    'difference_amount'=>'',
+                    'occupied_amount'=>'',
+                    'checked'=>'否',
+                    'returned'=>'无',
+                ]);
+            }
+        }
+        $this->response=$this->actingAs($this->user)->json('get','http://bswas/inventory/stockInventory/enterStockInventory/'.$this->inventory['id']);
+    }
+
+    function testEnterStockInventoryNotHavingException(){
+        $this->response->assertDontSee('Exception');
+    }
+
+    function testStockInventoryViewIsRight(){
+        $this->response->assertViewIs('inventory.stockInventory.inventoryMission');
+    }
+    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('inventoryAccountMissions');
+        $this->response->assertViewHas('inventoryAccount');
+    }
+    function tearDown(): void
+    {
+        DB::table('user_role')->where('id_role',$this->role['id'])->delete();
+        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();
+        InventoryAccountMission::where('inventory_account_id',$this->inventory['id'])->delete();
+        InventoryAccount::where('id',$this->inventory['id'])->forceDelete();
+        parent::tearDown(); // TODO: Change the autogenerated stub
+    }
+}
+

+ 58 - 0
tests/Inventory/http/InventoryAccountControllor/InventoryAccountController_MissionTest.php

@@ -0,0 +1,58 @@
+<?php
+
+
+namespace Tests\Inventory\Http\InventoryController;
+
+
+use App\Authority;
+use App\Owner;
+use App\Role;
+use App\User;
+use Illuminate\Support\Facades\DB;
+use Tests\TestCase;
+
+class InventoryControllerMissionTest extends TestCase
+{
+    public $response=null;
+    public $role;
+    public $user;
+    function setUp(): void
+    {
+        parent::setUp(); // TODO: Change the autogenerated stub
+        if(!$this->user){
+            $this->user = factory(User::class)->create();
+            $this->role= Role::firstOrCreate([
+                'name'=>'testRole',
+            ]);
+            $this->assertNotEmpty($this->role->id);
+            $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]);
+        }
+        $url = 'http://bswas/inventory/stockInventory/mission';
+        $this->response=$this->actingAs($this->user)->get($url);
+    }
+
+    function testMissionNotHavingException(){
+        $this->response->assertDontSee('Exception');
+    }
+    function testMissionViewIsRight(){
+        $this->response->assertViewIs('inventory.stockInventory.mission');
+    }
+    function testMissionHasOwners(){
+        $owners=Owner::select('id','name')->get();
+        $this->response->assertViewHas('owners',$owners);
+    }
+    function testMissionHasInventories(){
+        $this->response->assertViewHas('inventoryAccounts');
+    }
+
+    function tearDown(): void
+    {
+        DB::table('user_role')->where('id_role',$this->role['id'])->delete();
+        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();
+        parent::tearDown(); // TODO: Change the autogenerated stub
+    }
+}

部分文件因为文件数量过多而无法显示