浏览代码

Merge remote-tracking branch 'origin/fyy' into fyy

root 2 年之前
父节点
当前提交
8931d082f5

+ 9 - 2
app/Service/FinishedOrderService.php

@@ -58,7 +58,11 @@ class FinishedOrderService extends Service
             'result' => $msg,
             'data' => $data,
         ];
-        $job = dispatch(new ProcessDataJob($redis,$user,1))->onQueue(ProcessDataJob::job_one);
+        file_put_contents('1.txt','start:'.microtime(true).PHP_EOL,8);
+        $job = ProcessDataJob::dispatch($redis,$user,1)->onQueue('finished_operation');
+        file_put_contents('1.txt','end:'.microtime(true).PHP_EOL,8);
+        $job =true;
+
         if(! $job){
             return [false,'任务没有进入队列!'];
         }
@@ -70,6 +74,7 @@ class FinishedOrderService extends Service
         DispatchSub::whereIn('id',$data['id'])->update([
             'job_status' => 1,
         ]);
+
         return [true,'任务已进入队列!'];
     }
 
@@ -386,7 +391,9 @@ class FinishedOrderService extends Service
             'data' => $data,
             'quantity_count' => $count_arr,
         ];
-        $job = dispatch(new ProcessDataJob($redis,$user,3))->onQueue(ProcessDataJob::job_one);
+        file_put_contents('1.txt','start:'.time().PHP_EOL,8);
+        $job =  ProcessDataJob::dispatch($redis,$user,3)->onQueue(ProcessDataJob::job_one);
+        file_put_contents('1.txt','end:'.time().PHP_EOL,8);
         if(! $job) return [false,'任务没有进入队列!'];
 
         //错误计数

+ 3 - 4
app/Service/FyyOrderService.php

@@ -280,7 +280,7 @@ class FyyOrderService extends Service
         $list = [];
         if($data['type'] == 1){
             $list = SaleOrdersProduct::where('del_time',0)
-                ->select('out_order_no')
+                ->select('order_no','out_order_no','customer_name')
                 ->where('box_num', '>', 0)
                 ->whereColumn('order_quantity', '>', 'shipment_num')
                 ->groupBy('order_no')
@@ -288,15 +288,14 @@ class FyyOrderService extends Service
                 ->get()->toArray();
         }elseif($data['type'] == 2){
             $list = SaleOrdersProduct::where('del_time',0)
-                ->select('out_order_no')
+                ->select('order_no','out_order_no','customer_name')
                 ->whereColumn('order_quantity', '>', 'box_num')
                 ->groupBy('order_no')
                 ->orderBy('id','desc')
                 ->get()->toArray();
         }
 
-        $order = array_column($list,'out_order_no');
-        return [true, $order];
+        return [true, $list];
     }
 
     public function getShipmentOrder($data){

+ 19 - 10
app/Service/FyySqlServerService.php

@@ -190,16 +190,25 @@ class FyySqlServerService extends Service
         $result = $msg;
 
         //查询附带的一些信息(比较少)
-        $product_no = array_column($result,'product_no');
-        $messageOne = $this->db->table('Inventory as a')
-            ->join('ComputationUnit as b',function($join){
-                $join->on('a.cGroupCode','=','b.cGroupCode')
-                    ->on('a.cComUnitCode','=','b.cComUnitCode');
-            }, null,null,'left')
-            ->whereIn('a.cInvCode',$product_no)
-            ->select('a.cInvCode as product_no','a.cInvName as product_title','a.cInvStd as product_size','b.cComUnitName as product_unit')
-            ->get()->toArray();
-        $messageMap = array_column($messageOne,null,'product_no');
+        $product_no = array_filter(array_column($result,'product_no'));
+        $chunkSize = 1000; // 每个子集的大小
+        $chunks = array_chunk($product_no, $chunkSize); // 将原始数组拆分成多个较小的子数组
+
+        $results = []; // 存储查询结果的数组
+        foreach ($chunks as $chunk) {
+            $tmp = $this->db->table('Inventory as a')
+                ->join('ComputationUnit as b', function ($join) {
+                    $join->on('a.cGroupCode', '=', 'b.cGroupCode')
+                        ->on('a.cComUnitCode', '=', 'b.cComUnitCode');
+                }, null, null, 'left')
+                ->whereIn('a.cInvCode', $chunk)
+                ->select('a.cInvCode as product_no', 'a.cInvName as product_title', 'a.cInvStd as product_size', 'b.cComUnitName as product_unit')
+                ->get()
+                ->toArray();
+            $results = array_merge($results, $tmp); // 将每个子集的结果合并到总结果数组中
+        }
+        $messageMap = array_column($results,null,'product_no');
+        unset($results);
 
         //现存量查询开始 ---组织查询条件
         $args = '';

+ 4 - 2
app/Service/ProductionOrderService.php

@@ -251,7 +251,7 @@ class ProductionOrderService extends Service
 
     public function productionExport($data){
         $model = OrdersProduct::where('del_time',0)
-            ->select('id','order_no','out_order_no','out_order_no_time','customer_no','customer_name','table_header_mark','product_no','product_title','product_size','product_unit','order_quantity','technology_material','technology_name','wood_name','process_mark','table_body_mark','out_crt_man','out_checker_man','out_checker_time','production_quantity','production_time','production_no','status','sale_orders_product_id')
+            ->select('production_time', 'production_no', 'out_order_no_time','out_order_no','customer_no','customer_name','table_header_mark','product_no','product_title','product_size','product_unit','order_quantity','production_quantity','technology_material','technology_name','wood_name','process_mark','table_body_mark','out_crt_man','sale_orders_product_id')
             ->orderBy('id','desc');
 
         if(! empty($data['order_no'])) $model->where('order_no', 'LIKE', '%'.$data['order_no'].'%');
@@ -291,11 +291,13 @@ class ProductionOrderService extends Service
         $production_map = $this->getProductionOrderQuantity($sale_orders_product_id);
 
         date_default_timezone_set("PRC");
+
+        $exportFields = ['production_time', 'production_no', 'out_order_no_time','out_order_no','customer_no','customer_name','table_header_mark','product_no','product_title','product_size','product_unit','order_quantity','production_quantity','not_production','technology_material','technology_name','wood_name','process_mark','table_body_mark','out_crt_man']; // 指定要导出的字段
         foreach ($data as $key => $value){
             $data[$key]['out_order_no_time'] = $value['out_order_no_time'] ? date('Y-m-d',$value['out_order_no_time']) : '';
-            $data[$key]['out_checker_time'] = $value['out_checker_time'] ? date('Y-m-d',$value['out_checker_time']) : '';
             $data[$key]['production_time'] = $value['production_time'] ? date('Y-m-d',$value['production_time']) : '';
             $data[$key]['not_production'] = $value['order_quantity'] - ($production_map[$value['sale_orders_product_id']] ?? 0);
+            unset($data[$key]['sale_orders_product_id']);
         }
 
         return $data;