data["active_test"]="active"; } public function method(Request $request,$method) { return call_user_func([$this, $method],$request); } function t1(Request $request){ //x $packagesBatch=Package::where('batch_number',$batch_number)->first(); $waybills=Waybill::all(); $controller=(new WaybillController()); $waybills->each(function ($waybill)use($controller){ $controller->accomplishToWMS($waybill); }); } function tj(Request $request){ $a=11; try{ $b=22; }catch (\Exception $exception){ $this->log(__METHOD__,'Exception_'.__FUNCTION__,'请求异常:'.$exception->getMessage(),null); return ['result'=>'false']; } echo $a+$b; } function injectJS(Request $request){ $items=RejectedBillItem::whereHas('rejectedBill',function($query){ return $query->where('id_owner',2); })->where('created_at','>','2019-12-23 18:11:00')->where('created_at','<','2019-12-24 11:25:00')->get(); (new RejectedBillItemController())->collectionsToPackConfirm($items); } public function tj2(Request $request) { $rejected = Rejected::find(10); $rejectedJianshang=new \App\Http\Controllers\api\jianshang\RejectedController(); dd( $rejectedJianshang->sendRejected($rejected)); } public function excelIt() { $excel=new ExcelController(); return $excel->makeExcel(); } public function featureIt() { LogisticNumberFeatureController::loadRecentRejectedsToFeatures(5,2500); } public function newSku() { $url='http://bswcs/api/sorting/flux/newSku'; $response = Zttp::post($url, [ 'request'=>[ [ "SKU"=> "1234567890", "NAME"=> "瑞士莲**巧克力", "Alternate_SKU1"=> "1122334455", "GrossWeight"=> "1.2", "Cube"=> "0.75", "SKULength"=> "0.25", "SKUWidth"=> "0.15", "SKUHigh"=> "0.05" ], [ "SKU"=> "1234567892", "NAME"=> "跳跳饼", "Alternate_SKU1"=> "", "GrossWeight"=> "1.3", "Cube"=> "0.75", "SKULength"=> "0.25", "SKUWidth"=> "0.15", "SKUHigh"=> "0.25" ], ] ]); return $response->json(); } public function changePackage(){ $packages=Package::where('delivery_number','<>',null)->where('logistic_id',null)->get(); dd($packages); $packages=Package::whereRaw('delivery_number IS NOT NULL AND logistic_id IS NULL')->get(); $logistics=Logistic::get(); $packages->each(function ($package)use($logistics){ $logistics->each(function ($logistic)use($package){ if ($package->WMSReflectPackage->CarrierID==$logistic->code){ $package->logistic_id=$logistic->id; return; } }); }); return "OK"; } public function tNull(){ } public function deletePackageAuthority() { $authorities=Authority::where('name','like','%包裹信息%')->get(); $authorities->each(function ($authority){ $authority->delete(); }); } public function test3() { $strs=["auibh","aopk","bikon"]; if (!$strs[0])return ""; $len=strlen($strs[0]); for ($i=1;$i "(", "}" => "{", "]" => "[", ]; $len = strlen($s); $stack = []; if ($len%2!=0)dd(false); //s中出现map的key则弹出,没有出现则入栈 for ($i =0; $i<$len; $i++) { var_dump("data:".$s[$i]); if (isset($map[$s[$i]])){ //s中出现map的key:如果能找到对应的map的值 (,{,[ 则说明有配对,则弹出 if (isset($stack) && $stack[0] == $map[$s[$i]]) { array_shift($stack); } else { //仅找到后面的一部分,说明是不匹配的 dd(false); } var_dump("value1:".$map[$s[$i]]); var_dump($stack); } else { array_unshift($stack, $s[$i]); var_dump("value2:".$s[$i]); var_dump($stack); } } if (count($stack) > 0) { dd(false); } dd(true); //利用栈的先进后出 一个正确的括号组对应都为1对1或N对N // 先进后出“([{”入栈,")]}"出栈,轮询到出栈元素去映射栈顶,符合出栈,不符合直接返回 //依次轮询 如果映射正确那么最后栈为空栈 否则返回false } function test5(Request $request){ $page=$request->input('page')??1; $date_start=$request->input('date_start'); $date_end=$request->input('date_end'); $sql='select * from (select result.*,rownum rn from ('; $sql.=' select customer.Descr_C 货主, 库位, sku.SKU 产品编码, sku.ALTERNATE_SKU1 产品条码, '; $sql.=' sku.Descr_C 商品名称, lot.LotAtt05 属性仓, lot.LotAtt08 质量状态, lot.LotAtt02 失效日期, '; $sql.=' lot.LotAtt04 批号 '; $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 > '".$date_start." 00:00:00' "; if ($date_end) $sql.=" and addtime < '".$date_end." 23:59:59' "; if (!$date_start && !$date_end)$sql .= " and addtime >'".date('Y-m-d H:i:s',strtotime("-1 day"))."' "; $sql.=' group by TOCustomerID, TOLocation, TOCustomerID,FMSKU,FMLotNum union all '; $sql.=' select FMLotNum,FMSKU,TOCustomerID,sum(FMQty_Each) as 移出数量, 0 as 移入数量, FMLOCATION as 库位 '; $sql.=" from ACT_Transaction_Log where TransactionType='SO' "; if ($date_start) $sql.=" and addtime > '".$date_start." 00:00:00' "; if ($date_end) $sql.=" and addtime < '".$date_end." 23:59:59' "; if (!$date_start && !$date_end)$sql .= " and addtime >'".date('Y-m-d H:i:s',strtotime("-1 day"))."' "; $sql.=' group by FMCustomerID, FMLocation, TOCustomerID,FMSKU,FMLotNum union all '; $sql.=' select FMLotNum,FMSKU,TOCustomerID,sum(FMQty_Each) as 移出数量,0 as 移入数量, FMLocation as 库位 '; $sql.=" from ACT_Transaction_Log where TransactionType='MV' "; if ($date_start) $sql.=" and addtime > '".$date_start." 00:00:00' "; if ($date_end) $sql.=" and addtime < '".$date_end." 23:59:59' "; if (!$date_start && !$date_end)$sql .= " and addtime >'".date('Y-m-d H:i:s',strtotime("-1 day"))."' "; $sql.=' group by FMLocation,TOCustomerID,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 > '".$date_start." 00:00:00' "; if ($date_end) $sql.=" and addtime < '".$date_end." 23:59:59' "; if (!$date_start && !$date_end)$sql .= " and addtime >'".date('Y-m-d H:i:s',strtotime("-1 day"))."' "; $sql.=' group by TOLocation,TOCustomerID,FMSKU,FMLotNum)stockLog '; $sql.=' left join BAS_Customer customer on customer.CustomerID=stockLog.TOCUSTOMERID '; $sql.=' left join BAS_SKU sku on sku.SKU=stockLog.FMSKU '; $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.库位 where ROWNUM<=50 '; $sql.=' group by 库位,customer.Descr_C,sku.SKU,sku.ALTERNATE_SKU1 '; $sql.=' ,sku.Descr_C,FMLotNum,lot.LotAtt05,lot.LotAtt08,lot.LotAtt02,lot.LotAtt04 '; $sql.=' , storeStatus.QTY, storeStatus.QtyAllocated '; $sql.=' )result) where rn>0'; $oracleActTransactingLogs1=DB::connection('oracle')->select($sql); unset($sql); $sql='select * from (select result.*,rownum rn from ('; $sql.=' select customer.Descr_C 货主, 库位, sku.SKU 产品编码, sku.ALTERNATE_SKU1 产品条码, '; $sql.=' sku.Descr_C 商品名称, lot.LotAtt05 属性仓, lot.LotAtt08 质量状态, lot.LotAtt02 失效日期, '; $sql.=' lot.LotAtt04 批号 '; $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 > '".$date_start." 00:00:00' "; if ($date_end) $sql.=" and addtime < '".$date_end." 23:59:59' "; if (!$date_start && !$date_end)$sql .= " and addtime >'".date('Y-m-d H:i:s',strtotime("-1 day"))."' "; $sql.=' group by TOCustomerID, TOLocation, TOCustomerID,FMSKU,FMLotNum union all '; $sql.=' select FMLotNum,FMSKU,TOCustomerID,sum(FMQty_Each) as 移出数量, 0 as 移入数量, FMLOCATION as 库位 '; $sql.=" from ACT_Transaction_Log where TransactionType='SO' "; if ($date_start) $sql.=" and addtime > '".$date_start." 00:00:00' "; if ($date_end) $sql.=" and addtime < '".$date_end." 23:59:59' "; if (!$date_start && !$date_end)$sql .= " and addtime >'".date('Y-m-d H:i:s',strtotime("-1 day"))."' "; $sql.=' group by FMCustomerID, FMLocation, TOCustomerID,FMSKU,FMLotNum union all '; $sql.=' select FMLotNum,FMSKU,TOCustomerID,sum(FMQty_Each) as 移出数量,0 as 移入数量, FMLocation as 库位 '; $sql.=" from ACT_Transaction_Log where TransactionType='MV' "; if ($date_start) $sql.=" and addtime > '".$date_start." 00:00:00' "; if ($date_end) $sql.=" and addtime < '".$date_end." 23:59:59' "; if (!$date_start && !$date_end)$sql .= " and addtime >'".date('Y-m-d H:i:s',strtotime("-1 day"))."' "; $sql.=' group by FMLocation,TOCustomerID,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 > '".$date_start." 00:00:00' "; if ($date_end) $sql.=" and addtime < '".$date_end." 23:59:59' "; if (!$date_start && !$date_end)$sql .= " and addtime >'".date('Y-m-d H:i:s',strtotime("-1 day"))."' "; $sql.=' group by TOLocation,TOCustomerID,FMSKU,FMLotNum)stockLog '; $sql.=' left join BAS_Customer customer on customer.CustomerID=stockLog.TOCUSTOMERID '; $sql.=' left join BAS_SKU sku on sku.SKU=stockLog.FMSKU '; $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.库位 where ROWNUM<=500 '; $sql.=' group by 库位,customer.Descr_C,sku.SKU,sku.ALTERNATE_SKU1 '; $sql.=' ,sku.Descr_C,FMLotNum,lot.LotAtt05,lot.LotAtt08,lot.LotAtt02,lot.LotAtt04 '; $sql.=' , storeStatus.QTY, storeStatus.QtyAllocated '; $sql.=' )result) where rn>50'; $oracleActTransactingLogs2=DB::connection('oracle')->select($sql); $oracleActTransactingLogs1=json_encode($oracleActTransactingLogs1); $oracleActTransactingLogs2=json_encode($oracleActTransactingLogs2); $oracleActTransactingLogs1=json_decode($oracleActTransactingLogs1,true); $oracleActTransactingLogs2=json_decode($oracleActTransactingLogs2,true); foreach ($oracleActTransactingLogs1 as $oracleActTransactingLog1){ foreach ($oracleActTransactingLogs2 as $oracleActTransactingLog2){ if ($oracleActTransactingLog1['产品编码']==$oracleActTransactingLog2['产品编码']){ /*if ($oracleActTransactingLog1['产品编码']=='6206100971005')*/var_dump(['oracleActTransactingLog1'=>$oracleActTransactingLog1,'oracleActTransactingLog2'=>$oracleActTransactingLog2]); } } } } }