<?php

use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\Auth;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    return redirect('login');
});

Route::any('test/{method}', 'TestController@method'); //测试

Auth::routes();
Route::get('/home', 'HomeController@index')->name('home');
Route::get('/homeTemp', 'HomeController@home');

Route::get('password/change', 'Auth\PasswordController@change');
Route::post('password/update', 'Auth\PasswordController@update');
Route::get('maintenance/commodity/import', 'CommodityController@import');
Route::post('maintenance/commodity/import/excel', 'CommodityController@importExcel');

Route::resource('maintenance/log', 'LogController');
Route::resource('maintenance/user', 'UserController');
Route::resource('maintenance/role', 'RoleController');
Route::resource('maintenance/authority', 'AuthorityController');
Route::resource('maintenance/owner', 'OwnerController');
Route::resource('maintenance/logistic', 'LogisticController');
Route::resource('maintenance/qualityLabel', 'QualityLabelController');
Route::resource('maintenance/carrier', 'CarriersController');
Route::resource('maintenance/carType','CarTypesController');
Route::resource('maintenance/unit','UnitsController');
Route::resource('maintenance/province','ProvincesController');
Route::resource('maintenance/city','CitiesController');
Route::resource('maintenance/commodity', 'CommodityController');
Route::resource('maintenance/measuringMachine', 'MeasuringMachineController');
Route::resource('maintenance/userWorkgroup', 'UserWorkgroupController');
Route::resource('maintenance/laborCompany', 'LaborCompanyController');
Route::resource('maintenance/warehouse', 'WarehouseController');
Route::resource('maintenance/jobType', 'JobTypeController');
//教程管理
Route::resource('maintenance/tutorial', 'TutorialController');
//停用货主
Route::get('maintenance/owners/recycle','OwnerController@recycle');
//教程展示
Route::post('maintenance/tutorial/showContent/{id}', 'TutorialController@showContent');
//临时工管理
Route::resource('maintenance/userLabor','UserLaborController');
//获取劳务记录
Route::post('maintenance/userLabor/getWorkRecord', 'UserLaborController@getWorkRecord');
//获取打卡记录
Route::post('maintenance/userLabor/getClockRecord', 'UserLaborController@getClockRecord');
//解除绑定设备
Route::post('maintenance/userLabor/relieve', 'UserLaborController@relieve');

Route::get('maintenance/paperBox/index/model', 'PaperBoxController@indexModel');
Route::get('maintenance/paperBox/index/owner', 'PaperBoxController@indexOwner');
Route::post('maintenance/paperBox/excel/import','PaperBoxController@import');
Route::resource('maintenance/paperBox', 'PaperBoxController');
Route::get('maintenance/paperBox/excel/goImport',function (){return view('maintenance.paperBox.import');});

Route::post('waybill/deleteImg','WaybillController@deleteImg');
Route::post('waybill/upload','WaybillController@upload');
Route::get('waybill/relating',function (){return view('waybill.menuWaybill');});
Route::resource('maintenance/waybillPriceModel','WaybillPriceModelsController');
Route::get('maintenance/waybillPriceModel/excel/goImport',function (){return view('maintenance.waybillPriceModel.import');});
Route::get('maintenance/waybillPriceModel/cities/{province_id}','WaybillPriceModelsController@getCities');

Route::resource('waybill/waybillFinancialSnapshot','WaybillFinancialSnapshotsController');
Route::resource('waybill/waybillFinancialExcepted','WaybillFinancialExceptedController');

Route::get('waybill/recycle', 'WaybillController@recycle');   //回收站
Route::any('waybill/ontop/top','WaybillController@waybillOnTop');
Route::any('waybill/ontop/cancel','WaybillController@cancelOnTop');

Route::post('waybill/refreshWaveHouseWeight','WaybillController@refreshWaveHouseWeight');

Route::get('waybill/index','WaybillController@index');
Route::get('waybill/delivering','WaybillController@delivering');
Route::post('waybill/storeCarrierBill','WaybillController@storeCarrierBill');
Route::post('waybill/is/waybillPriceModel','WaybillController@isWaybillPriceModel');
Route::post('waybill/addCounty','WaybillController@addCounty');
Route::any('waybill/waybillAudit','WaybillController@waybillAudit');
Route::any('waybill/waybillEdit/{id}','WaybillController@waybillEdit');
Route::any('waybill/waybillRetreatAudit','WaybillController@waybillRetreatAudit');
Route::any('waybill/waybillEndAudit','WaybillController@waybillEndAudit');
Route::any('waybill/export','WaybillController@export');
Route::any('waybill/waybillUpdate/{id}','WaybillController@waybillUpdate');
Route::resource('waybill','WaybillController');


Route::any('waybillFinancialSnapshot/export/{id}','WaybillFinancialSnapshotsController@export');
Route::post('waybillPriceModel/excel/import','WaybillPriceModelsController@import');


Route::post('rejectedBill/{rejectedBill}/edit', 'RejectedBillController@edit');
Route::resource('rejectedBill', 'RejectedBillController');
Route::get('rejected/import', 'RejectedController@import');
Route::post('rejected/import/excel', 'RejectedController@importExcel');
Route::get('rejected/relating', function () {return view('rejected.relating');});
Route::get('rejected/recycle', 'RejectedController@recycle');
Route::post('rejected/ajaxCheck', 'RejectedController@ajaxCheck');
Route::post('rejected/ajaxCheckAll', 'RejectedController@ajaxCheckAll');
Route::post('rejected/ajaxFinishAll', 'RejectedController@ajaxFinishAll');
Route::any('rejected/export', 'RejectedController@export');
Route::any('rejected/index/general','RejectedController@index');  // 一般查询
Route::any('rejected/index/analyze','RejectedController@indexAnalyze');  // 统计查询
Route::any('rejected/exportAnalyze', 'RejectedController@exportAnalyze');
Route::resource('rejected', 'RejectedController');


Route::post('rejected/analyze/exportExcelOnParams', 'RejectedController@exportExcelOnParams');
Route::post('rejected/analyze/exportAllExcelOnParams', 'RejectedController@exportAllExcelOnParams');
Route::post('rejected/ajaxGetRejected', 'RejectedController@ajaxGetRejected');

Route::get('maintenance/', function () {return view('maintenance.index');});
Route::any('package/measureMonitor/speech','MeasureMonitorController@speech');
Route::post('package/measureMonitor/data','MeasureMonitorController@data');
Route::resource('package/measureMonitor','MeasureMonitorController');
Route::any('package/export','PackageController@export');
Route::get('package/statistics','PackageController@statistics');
Route::get('package/statisticExport','PackageController@statisticExport');
Route::get('package/relating', function () {return view('weight.menuWeight');});
Route::get('package/weightExcepted/indexCreate','WeighExceptedController@indexCreate');
Route::get('package/weightExcepted/indexIssued','WeighExceptedController@indexIssued');
Route::get('package/weightExcepted/export/{id}','WeighExceptedController@export');
Route::resource('package','PackageController');

Route::get('store','StoreController@index');
Route::resource('store/fast','StoreController');
Route::resource('store/storeItem','StoreItemsController');


/**
 *二维码
 */
//进入打卡
Route::get('personnel/checking-in/goGetQRCode','QRCodeController@goGetQRCode');
//进入组二维码显示页面
Route::get('personnel/checking-in/QRCode','QRCodeController@QRCode');
////打卡页面点击仓库获取所有的工作组
//Route::get('personnel/checking-in/getUserWorkGroups','QRCodeController@getUserWorkGroups');

//进入进出场二维码显示页面
Route::get('personnel/checking-in/importAndExportQRCode','QRCodeController@importAndExportQRCode');
//获取刷新二维码
Route::post('personnel/checking-in/refreshQRCode','QRCodeController@refreshQRCode');
/**
 *  用户打卡
 */
Route::group(['prefix'=>'personnel/checking-in/userDutyCheck'],function(){
    //进出场打卡接口
    Route::get('importAndExportClock','UserDutyCheckController@importAndExportClock');
    //进入打卡接口
    Route::get('clock','UserDutyCheckController@clock');
    //进出场提交打卡
    Route::post('storeClock','UserDutyCheckController@storeClock');
    //进出场提交打卡
    Route::post('importGroupClock','UserDutyCheckController@importGroupClock');
    //去往登记资料页面
    Route::get('createUserDetail/{mobile_phone}','UserDutyCheckController@createUserDetail');
    //去往修改资料页面
    Route::get('updateUserLaborCompanies/{mobile_phone}','UserDutyCheckController@updateUserLaborCompanies');
    //提交登记资料
    Route::post('storeUserDetail','UserDutyCheckController@storeUserDetail');
    //提交修改劳务所
    Route::post('storeUpdateUserLaborCompanies','UserDutyCheckController@storeUpdateUserLaborCompanies');
});
Route::group(['prefix'=>'process'],function(){
    //相关设置
    Route::get('relating',function (){return view('process.menuProcess');});
    //统计页面
    Route::get('statistic','ProcessStatisticController@index');
    //获取每日参与人
    Route::post('getDailyParticipant','ProcessController@getDailyParticipant');
    //驳回
    Route::post('reject/{id}','ProcessController@reject');
    //接单
    Route::post('receive/{id}','ProcessController@receive');
    //完成
    Route::post('accomplish','ProcessController@accomplish');
    //修改每日产量
    Route::post('updateDailyOutput','ProcessController@updateDailyOutput');
    //添加参与人
    Route::post('storeProcessDailyParticipant','ProcessController@storeProcessDailyParticipant');
    //验证参与人
    Route::post('verifyUserName','ProcessController@verifyUserName');
    //修改参与人
    Route::post('updateProcessDailyParticipant','ProcessController@updateProcessDailyParticipant');
    //参与人审核
    Route::post('processDailyParticipantAudit/{id}','ProcessController@processDailyParticipantAudit');
    //临时工详情
    //Route::post('showUserDetail','ProcessController@showUserDetail');
    //获取全部教程
    Route::post('getTutorials/{id}','ProcessController@getTutorials');
    //添加教程关联
    Route::post('selectedTutorial','ProcessController@selectedTutorial');
    //删除教程关联
    Route::post('deleteTutorial','ProcessController@deleteTutorial');
    //根据货主获取教程
    Route::post('ownerGetTutorials/{owner_id}','ProcessController@ownerGetTutorials');
    //删除二次加工内容单
    Route::post('deleteProcessContent/{id}','ProcessController@deleteProcessContent');
    //回滚状态
    Route::post('rollback','ProcessController@rollback');
    //回收站
    Route::get('recycle','ProcessController@recycle');
    //恢复
    Route::post('recover','ProcessController@recover');
    //审核
    Route::post('audit','ProcessController@audit');
    //加工完成
    Route::post('processAccomplish','ProcessController@processAccomplish');
    //验收
    Route::post('checkAndAccept','ProcessController@checkAndAccept');
    //修改价格
    Route::post('updateUnitPrice','ProcessController@updateUnitPrice');
    //二次加工组审核
    Route::post('workGroupVerify','ProcessController@workGroupVerify');
    //财务审核
    Route::post('accountantVerify','ProcessController@accountantVerify');
    //修改起始日期
    Route::post('updateStartDate','ProcessController@updateStartDate');
    //修改终止日期
    Route::post('updateEndDate','ProcessController@updateEndDate');
    //删除临时工工作记录
    Route::delete('destroyDailyParticipant/{id}','ProcessController@destroyDailyParticipant');
    //导入粘贴商品数据
    Route::post('importPasteData','ProcessController@importPasteData');
    //导出
    Route::any('export','ProcessController@export');
});
//process主方法 restful
Route::resource('process','ProcessController');

/**
 * 人事
 */
//临时工报表界面
Route::resource('personnel/laborReport','LaborReportController');

Route::get('getLaborReport','LaborReportController@getDailyLabor');
Route::group(['prefix'=>'laborReport'],function(){
    //门卫打卡审核
    Route::post('guardClockAudit','LaborReportController@guardClockAudit');
    //组长打卡审核
    Route::post('groupClockAudit','LaborReportController@groupClockAudit');
    //组长打卡审核(特定组添加备注)
    Route::post('addRemarkAndGroupClock','LaborReportController@addRemarkAndGroupClock');
    //组长点击退场
    Route::post('groupExport','LaborReportController@groupExport');
    //组长点击退场，是否包含晚饭时间情况
    Route::post('groupExportEnsure','LaborReportController@groupExportEnsure');
    //导出
    Route::any('export','LaborReportController@export');
});

Route::group(['prefix'=>'personnel'],function(){
    //去往录入补卡
    Route::get('checking-in/createReplenishClock','PersonnelController@createReplenishClock');
    //搜索临时工下打卡信息
    Route::post('checking-in/checkUserLabors','PersonnelController@checkUserLabors');
    //录入补卡
    Route::post('checking-in/storeReplenishClock','PersonnelController@storeReplenishClock');
    //去往打卡审核
    Route::get('checking-in/clockAudit','PersonnelController@clockAudit');
    //去往任务审核
    Route::get('checking-in/missionAudit','PersonnelController@missionAudit');
    //打卡审核
    Route::post('checking-in/storeClockAudit','PersonnelController@storeClockAudit');
    //打卡审核类型
    Route::post('checking-in/updateDutyCheckType','PersonnelController@updateDutyCheckType');
    //打卡组长审核
    Route::post('checking-in/storeGroupAudit','PersonnelController@storeGroupAudit');
    //打卡审核登出类型判断异常
    Route::post('checking-in/isException','PersonnelController@isException');
    //任务审核
    Route::post('checking-in/storeMissionAudit','PersonnelController@storeMissionAudit');
    //相关设置
    Route::get('relating',function (){return view('personnel/menuPersonnel');});
});

/**
 * 库存
 */
Route::group(['prefix'=>'inventory'],function (){
    //动库报表
    Route::get('statement/changeInventory','InventoryController@changeInventory');
    Route::any('statement/changeInventory/export','InventoryController@exportData');
    Route::get('statement/changeInventory/downLoadExcel','InventoryController@downLoadExcel');
    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::any('stockInventoryExport','InventoryController@stockInventoryExport');
    Route::any('stockInventory','InventoryController@stockInventory');
});

/**
 * 出库
 */
Route::group(['prefix'=>'order'],function(){
    //发运
    Route::any('index/delivering','OrderController@delivering');
    //批量备注
    Route::post('create/batchComments','OrderController@batchComments');
    //冻结订单
    Route::post('freeze','OrderController@freeze');
    //批量冻结订单
    Route::post('freezeAll','OrderController@freezeAll');
    //解冻订单
    Route::post('thaw','OrderController@thaw');
    //取消分配
    Route::post('deAllocation','OrderController@deAllocation');
    //批量取消分配
    Route::post('deAllocationAll','OrderController@deAllocationAll');
});

/**
 * 波次
 */
Route::group(['prefix'=>'order'],function(){
    // index
    Route::get('wave/index','WaveController@index');
    // cancel printing by id or ids
    Route::post('wave/cancelPrinting','WaveController@cancelPrinting');
    // export Excel
    Route::any('wave/exportExcel','WaveController@exportExcelOnParams');
});
/**
 * 问题件
 */
Route::group(['prefix'=>'order'],function(){
    Route::get('issue/index','OrderIssueController@index');// 查询
    Route::get('issue/create','OrderIssueController@create'); // 录入
    Route::post('issue/store','OrderIssueController@store'); // 录入

    Route::post('issue/batchImport','OrderIssueController@batchImport'); // 批量导入
    Route::get('issue/excelImport','OrderIssueController@excelImport'); // 前往
    Route::get('issue/edit/{id}','OrderIssueController@edit');// 编辑
    Route::match(['get','post'],'issue/export','OrderIssueController@exportOrderIssue');// 导出
});
