浏览代码

客户简称改为基础档案

cqpCow 1 年之前
父节点
当前提交
f1c7e4748c
共有 2 个文件被更改,包括 10 次插入8 次删除
  1. 4 2
      app/Service/SalesOrderService.php
  2. 6 6
      app/Service/U8ServerService.php

+ 4 - 2
app/Service/SalesOrderService.php

@@ -59,7 +59,7 @@ class SalesOrderService extends Service
             $model->install_method = $data['install_method'] ?? 0;
             $model->install_position = $data['install_position'] ?? 0;
             $model->customer_id = $data['customer_id'] ?? 0;
-            $model->customer_short_name = $data['customer_short_name'] ?? "";
+            $model->customer_short_name = $data['customer_short_name'] ?? 0;
             $model->customer_contact = $data['customer_contact'] ?? "";
             $model->sign_time = $data['sign_time'] ?? 0;
             $model->product_total = $data['product_total'] ?? 0;
@@ -240,7 +240,7 @@ class SalesOrderService extends Service
             $model->install_method = $data['install_method'] ?? 0;
             $model->install_position = $data['install_position'] ?? 0;
             $model->customer_id = $data['customer_id'] ?? 0;
-            $model->customer_short_name = $data['customer_short_name'] ?? "";
+            $model->customer_short_name = $data['customer_short_name'] ?? 0;
             $model->customer_contact = $data['customer_contact'] ?? "";
             $model->sign_time = $data['sign_time'] ?? 0;
             $model->product_total = $data['product_total'] ?? 0;
@@ -553,6 +553,7 @@ class SalesOrderService extends Service
             $sales['pay_way'],
             $sales['install_method'],
             $sales['install_position'],
+            $sales['customer_short_name'],
         ];
         $basic_map = BasicType::whereIn('id',$array)
             ->pluck('title','id')
@@ -565,6 +566,7 @@ class SalesOrderService extends Service
             $sales[$key]['pay_way_title'] = $basic_map[$value['pay_way']] ?? '';
             $sales[$key]['install_method_title'] = $basic_map[$value['install_method']] ?? '';
             $sales[$key]['install_position_title'] = $basic_map[$value['install_position']] ?? '';
+            $sales[$key]['customer_short_name'] = $basic_map[$value['customer_short_name']] ?? '';
         }
         $sales = $sales[0];
 

+ 6 - 6
app/Service/U8ServerService.php

@@ -508,16 +508,16 @@ class U8ServerService extends Service
         $product = Product::whereIn('id',array_unique(array_column($sub,'product_id')))
             ->get()->toArray();
         $product_map = array_column($product,null,'id');
-        $code_id = array_filter(array_unique(array_merge_recursive(array_column($main,'sale_type'),array_column($main,'plat_type'),array_column($main,'install_position'))));
+        $code_id = array_filter(array_unique(array_merge_recursive(array_column($main,'sale_type'),array_column($main,'plat_type'),array_column($main,'install_position'),array_column($main,'customer_short_name'))));
         $code_map = BasicType::whereIn('id',$code_id)
             ->pluck('title','id')
             ->toArray();
         $customer_map = Customer::whereIn('id',array_unique(array_column($main,'customer_id')))
             ->pluck('title','id')
             ->toArray();
-        $depart = Depart::where('parent_id',0)
-            ->pluck('title','id')
-            ->toArray();
+//        $depart = Depart::where('parent_id',0)
+//            ->pluck('title','id')
+//            ->toArray();
         $emp = Employee::whereIn('id',array_unique(array_column($main,'crt_id')))
             ->pluck('number','id')
             ->toArray();
@@ -571,7 +571,7 @@ class U8ServerService extends Service
             $sub_map[$value['sales_order_id']][] = $value;
         }
         foreach ($main as $key => $value){
-//            $plat_type = $code_map[$value['plat_type']] ?? "";
+            $customer_short_name = $code_map[$value['customer_short_name']] ?? "";
 //            if($plat_type == "营销部"){
 //                $ccusabbname = "营销部客户";
 //            }else{
@@ -579,7 +579,7 @@ class U8ServerService extends Service
 //            }
             $main[$key]['cbustype'] = "普通销售"; //业务类型(本身就是中文)
             $main[$key]['cstname'] = SalesOrder::$model_type_title[$value['model_type']] ?? ""; //销售类型
-            $main[$key]['ccusabbname'] = $value['customer_short_name'];//客户简称
+            $main[$key]['ccusabbname'] = $customer_short_name;//客户简称
 //            $main[$key]['cdepname'] = $depart[$value['top_depart_id']] ?? "";//部门名称
 //            $main[$key]['cpersoncode'] = $emp[$value['crt_id']] ?? "";//业务员
             $main[$key]['jobnumber'] = $emp[$value['crt_id']] ?? "";