|
|
@@ -10,8 +10,12 @@ use App\MaterialBoxModel;
|
|
|
use App\Services\RejectedService;
|
|
|
use App\User;
|
|
|
use App\Waybill;
|
|
|
+use Illuminate\Database\Capsule\Manager;
|
|
|
+use Illuminate\Database\DatabaseManager;
|
|
|
+use Illuminate\Foundation\Auth\AuthenticatesUsers;
|
|
|
use Illuminate\Http\Request;
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
+use Illuminate\Support\Facades\Hash;
|
|
|
use Illuminate\Support\Facades\Log;
|
|
|
use Oursdreams\Export\Export;
|
|
|
|
|
|
@@ -34,117 +38,62 @@ class TestController extends Controller
|
|
|
dd("方法不存在");
|
|
|
}
|
|
|
}
|
|
|
- public function test(Request $request)
|
|
|
+ public function test($main, $x)
|
|
|
{
|
|
|
- $sql = <<<SQL
|
|
|
-select rejected_bills.*,
|
|
|
- CASE rejected_bills.is_loaded
|
|
|
- WHEN 0 THEN '否'
|
|
|
- WHEN 1 THEN '是'
|
|
|
- WHEN 2 THEN '待推单'
|
|
|
- WHEN 3
|
|
|
- THEN '上传异常'
|
|
|
- WHEN 4 THEN '待确认'
|
|
|
- ELSE '无需入库' END loaded,
|
|
|
- owners.name owner_name,
|
|
|
- logistics.name logistic_name,
|
|
|
- rejected_bill_items.created_at item_created_at,
|
|
|
- rejected_bill_items.barcode_goods item_barcode,
|
|
|
- rejected_bill_items.name_goods item_name,
|
|
|
- rejected_bill_items.remark item_remark,
|
|
|
- rejected_bill_items.amount item_amount,
|
|
|
- rejected_bill_items.batch_number item_batch_number,
|
|
|
- rejected_bill_items.made_at item_made_at,
|
|
|
- rejected_bill_items.validity_at item_validity_at,
|
|
|
- rejected_bill_items.remark item_remark,
|
|
|
- quality_labels.name quality_label_name,
|
|
|
- users.name operator_name
|
|
|
-from rejected_bills
|
|
|
- left join owners on rejected_bills.id_owner = owners.id
|
|
|
- left join logistics on
|
|
|
- rejected_bills.id_logistic_return = logistics.id
|
|
|
- left join rejected_bill_items on rejected_bills.id =
|
|
|
- rejected_bill_items.id_rejected_bill
|
|
|
- left join quality_labels on rejected_bill_items.id_quality_label = quality_labels.id
|
|
|
- left join users on rejected_bills.id_operator = users.id
|
|
|
-where rejected_bills.deleted_at is null
|
|
|
- and rejected_bill_items.deleted_at is null and rejected_bills.created_at between '2021-12-01 00:00:00' and '2021-12-31 23:59:59'
|
|
|
-order by rejected_bills.id desc
|
|
|
-SQL;
|
|
|
- $limit=$request->input("limit");
|
|
|
- $mapper = [
|
|
|
- "created_at"=>"日期","checked_numbers"=>"审核号",
|
|
|
- "owner_name"=>"客户名称","order_number"=>"订单号",
|
|
|
- "sender"=>"姓名","mobile_sender"=>"手机",
|
|
|
- "logistic_number"=>"原单单号","logistic_number_return"=>"退回单号","logistic_name"=>"退回公司",
|
|
|
- "fee_collected"=>"到付费用","loaded"=>"是否入库",
|
|
|
- "item_barcode"=>"商品条码","item_name"=>"商品名称",
|
|
|
- "item_amount"=>"商品数量","quality_label_name"=>"商品质量","item_remark"=>"备注","operator_name"=>"录入人","remark"=>"退单备注"
|
|
|
- ];
|
|
|
- $column = array_values($mapper);
|
|
|
- $data = DB::select(DB::raw($sql." limit {$limit},10000"));
|
|
|
- if (count($data)==0){
|
|
|
- dd("完成了");
|
|
|
+ return;
|
|
|
+ $db = DB::connection("aliyunMysql");
|
|
|
+ foreach ($db->select(DB::raw("select * from equipments where code like 'W4%' and info is not null and id <= 4972")) as $eq){
|
|
|
+ $arr = str_split ($eq->code);
|
|
|
+ if (strlen($main)==2){
|
|
|
+ $arr1 = str_split ($main);
|
|
|
+ $arr[4] = $arr1[0];
|
|
|
+ $arr[5] = $arr1[1];
|
|
|
+ }else{
|
|
|
+ $arr[5] = $main;
|
|
|
+ }
|
|
|
+ $code = implode("",$arr);
|
|
|
+
|
|
|
+ $obj = json_decode($eq->info);
|
|
|
+ $obj->x +=$x;
|
|
|
+ $db->insert("insert into equipments(code,parent_id,info,depth,width,created_at,updated_at,warehouse_detail_id)
|
|
|
+values(?,null,?,?,?,?,?,1)",[$code,json_encode($obj),$eq->depth,$eq->width,now()->toDateTimeString(),now()->toDateTimeString()]);
|
|
|
+
|
|
|
+ $a = $db->selectOne("select * from equipments where parent_id is null and code = ? ",[$code]);
|
|
|
+ foreach ($db->select("select * from equipments where parent_id = ?",[$eq->id]) as $item){
|
|
|
+ $arr = str_split ($item->code);
|
|
|
+ if (strlen($main)==2){
|
|
|
+ $arr1 = str_split ($main);
|
|
|
+ $arr[4] = $arr1[0];
|
|
|
+ $arr[5] = $arr1[1];
|
|
|
+ }else{
|
|
|
+ $arr[5] = $main;
|
|
|
+ }
|
|
|
+ $code = implode("",$arr);
|
|
|
+ $db->insert("insert into equipments(code,parent_id,info,depth,width,height,location_tab,created_at,updated_at,warehouse_detail_id)
|
|
|
+values(?,?,null,?,?,?,?,?,?,2)",[$code,$a->id,$item->depth,$item->width,$item->height,$item->location_tab,now()->toDateTimeString(),now()->toDateTimeString()]);
|
|
|
+ }
|
|
|
}
|
|
|
- $list = [];
|
|
|
- foreach ($data as $item){
|
|
|
- $list[] = [
|
|
|
- $item->created_at,
|
|
|
- $item->checked_numbers,
|
|
|
- $item->owner_name,
|
|
|
- $item->order_number,
|
|
|
- $item->sender,
|
|
|
- $item->mobile_sender,
|
|
|
- $item->logistic_number,
|
|
|
- $item->logistic_number_return,
|
|
|
- $item->logistic_name,
|
|
|
- $item->fee_collected,
|
|
|
- $item->loaded,
|
|
|
- $item->item_barcode,
|
|
|
- $item->item_name,
|
|
|
- $item->item_amount,
|
|
|
- $item->quality_label_name,
|
|
|
- $item->item_remark,
|
|
|
- $item->operator_name,
|
|
|
- $item->remark,
|
|
|
- ];
|
|
|
+ }
|
|
|
+ public function test2(){
|
|
|
+ return;
|
|
|
+ $db = DB::connection("aliyunMysql");
|
|
|
+ foreach ($db->select("select * from equipments where (code like 'W3%') and info is not null") as $eq){
|
|
|
+ $obj = json_decode($eq->info);
|
|
|
+ $obj->x -= 105;
|
|
|
+ $db->update("UPDATE equipments SET info = ? where id = ?",[json_encode($obj),$eq->id]);
|
|
|
}
|
|
|
- return Export::make($column,$list,"退货记录");
|
|
|
- Log::error(json_encode($request->header(),JSON_UNESCAPED_UNICODE));
|
|
|
- return json_encode($request->header(),JSON_UNESCAPED_UNICODE);
|
|
|
}
|
|
|
|
|
|
- private function paramDefault($waybill):array
|
|
|
- {
|
|
|
- $update = [];
|
|
|
- if (!$waybill->order_type){
|
|
|
- $update["order_type"] = $waybill->order_type = Waybill::ORDER_TYPE_DEFAULT;
|
|
|
- }
|
|
|
- if (!$waybill->transport_type){
|
|
|
- $update["transport_type"] = $waybill->transport_type = "JZKH";
|
|
|
- }
|
|
|
- if (!$waybill->cargo_name){
|
|
|
- $update["cargo_name"] = $waybill->cargo_name = "补货";
|
|
|
- }
|
|
|
- if (!$waybill->total_number){
|
|
|
- $update["total_number"] = $waybill->total_number = 1;
|
|
|
- }
|
|
|
- if (!$waybill->total_weight){
|
|
|
- $update["total_weight"] = $waybill->total_weight = 1;
|
|
|
- }
|
|
|
- if (!$waybill->package_service){
|
|
|
- $update["package_service"] = $waybill->package_service = '托膜';
|
|
|
- }
|
|
|
- if (!$waybill->deliveryType_id){
|
|
|
- $update["deliveryType_id"] = $waybill->deliveryType_id = 3;
|
|
|
- }
|
|
|
- if (!$waybill->pay_type){
|
|
|
- $update["pay_type"] = $waybill->pay_type = Waybill::PAY_TYPE_DEFAULT;
|
|
|
- }
|
|
|
- if (!$waybill->back_sign_bill){
|
|
|
- $update["back_sign_bill"] = $waybill->back_sign_bill = Waybill::BACK_SIGN_BILL_DEFAULT;
|
|
|
- }
|
|
|
- return array($update,$waybill);
|
|
|
+ public function test1(Request $request){
|
|
|
+ return;
|
|
|
+ $x = 0;
|
|
|
+ $a1 = 8 + 30;
|
|
|
+ $a2 = 80 + 30;
|
|
|
+ $a3 = 32 + 30;
|
|
|
+ }
|
|
|
+ use AuthenticatesUsers;
|
|
|
+ public function test3($request){
|
|
|
+ dd(Hash::make("wangyan"));
|
|
|
}
|
|
|
}
|
|
|
|