cqpCow 2 жил өмнө
parent
commit
899ab73ecb

+ 90 - 0
app/Http/Controllers/Api/FyyOrderController.php

@@ -0,0 +1,90 @@
+<?php
+
+namespace App\Http\Controllers\Api;
+
+
+use App\Service\FyyOrderService;
+use Illuminate\Http\Request;
+
+
+class FyyOrderController extends BaseController
+{
+    public function add(Request $request)
+    {
+        $service = new FyyOrderService();
+        $userData = $request->userData->toArray();
+        list($status,$data) = $service->add($request->all(),$userData);
+
+        if($status){
+            return $this->json_return(200,'',$data);
+        }else{
+            return $this->json_return(201,$data);
+        }
+    }
+
+    public function edit(Request $request)
+    {
+        $service = new FyyOrderService();
+        $user = $request->get('auth');
+        list($status,$data) = $service->edit($request->all());
+
+        if($status){
+            return $this->json_return(200,'',$data);
+        }else{
+            return $this->json_return(201,$data);
+        }
+    }
+
+    public function del(Request $request)
+    {
+        $service = new FyyOrderService();
+        $user = $request->get('auth');
+        list($status,$data) = $service->del($request->all());
+
+        if($status){
+            return $this->json_return(200,'',$data);
+        }else{
+            return $this->json_return(201,$data);
+        }
+    }
+
+
+    public function orderList(Request $request)
+    {
+        $service = new FyyOrderService();
+        $user = $request->get('auth');
+        list($status,$data) = $service->orderList($request->all());
+
+        if($status){
+            return $this->json_return(200,'',$data);
+        }else{
+            return $this->json_return(201,$data);
+        }
+    }
+
+
+    public function orderDetail(Request $request)
+    {
+        $service = new FyyOrderService();
+        $user = $request->get('auth');
+        list($status,$data) = $service->orderDetail($request->all());
+
+        if($status){
+            return $this->json_return(200,'',$data);
+        }else{
+            return $this->json_return(201,$data);
+        }
+    }
+
+    public function fyyRefreshOnHandQuantity(Request $request){
+        $service = new FyyOrderService();
+        $user = $request->get('auth');
+        list($status,$data) = $service->fyyRefreshOnHandQuantity($request->all());
+
+        if($status){
+            return $this->json_return(200,'',$data);
+        }else{
+            return $this->json_return(201,$data);
+        }
+    }
+}

+ 78 - 0
app/Http/Controllers/Api/ProductionOrderController.php

@@ -0,0 +1,78 @@
+<?php
+
+namespace App\Http\Controllers\Api;
+
+
+use App\Service\ProductionOrderService;
+use Illuminate\Http\Request;
+
+
+class ProductionOrderController extends BaseController
+{
+    public function add(Request $request)
+    {
+        $service = new ProductionOrderService();
+        $userData = $request->userData->toArray();
+        list($status,$data) = $service->add($request->all(),$userData);
+
+        if($status){
+            return $this->json_return(200,'',$data);
+        }else{
+            return $this->json_return(201,$data);
+        }
+    }
+
+    public function edit(Request $request)
+    {
+        $service = new ProductionOrderService();
+        $user = $request->get('auth');
+        list($status,$data) = $service->edit($request->all());
+
+        if($status){
+            return $this->json_return(200,'',$data);
+        }else{
+            return $this->json_return(201,$data);
+        }
+    }
+
+    public function del(Request $request)
+    {
+        $service = new ProductionOrderService();
+        $user = $request->get('auth');
+        list($status,$data) = $service->del($request->all());
+
+        if($status){
+            return $this->json_return(200,'',$data);
+        }else{
+            return $this->json_return(201,$data);
+        }
+    }
+
+
+    public function orderList(Request $request)
+    {
+        $service = new ProductionOrderService();
+        $user = $request->get('auth');
+        list($status,$data) = $service->orderList($request->all());
+
+        if($status){
+            return $this->json_return(200,'',$data);
+        }else{
+            return $this->json_return(201,$data);
+        }
+    }
+
+
+    public function orderDetail(Request $request)
+    {
+        $service = new ProductionOrderService();
+        $user = $request->get('auth');
+        list($status,$data) = $service->orderDetail($request->all());
+
+        if($status){
+            return $this->json_return(200,'',$data);
+        }else{
+            return $this->json_return(201,$data);
+        }
+    }
+}

+ 34 - 1
app/Model/OrdersProductBom.php

@@ -3,6 +3,8 @@
 namespace App\Model;
 
 use Illuminate\Database\Eloquent\Model;
+use Illuminate\Support\Facades\DB;
+use Illuminate\Support\Facades\Schema;
 
 /**
  *
@@ -11,9 +13,40 @@ use Illuminate\Database\Eloquent\Model;
  */
 class OrdersProductBom extends Model
 {
-    protected $table = "orders_product_bom"; //指定表
+    protected  $table = "";
+    protected $prefix_table = 'orders_product_bom'; // 对照表
     const CREATED_AT = 'crt_time';
     const UPDATED_AT = 'upd_time';
     protected $dateFormat = 'U';
+    //$fillable属性里面的字段是可以赋值的,其他的所有属性不能被赋值
+    //$guarded属性里面的字段是不可以赋值,其他的所有属性都能被赋值
+    protected $fillable = ['param']; // $attributes 里传参数需要配置这个参数名字
 
+    public function __construct(array $attributes = [])
+    {
+        $param = request()->get('param');
+
+        if(! empty($param)) $this->setTableByParam($param);
+
+        if(isset($attributes['param']) && $attributes['param'] > 0) $this->setTableByParam($attributes['param']);
+
+        $this->createTable($this->table);
+
+        parent::__construct($attributes);
+    }
+
+    public function setTableByParam($param){
+        if($param > 0){
+            $table = $this->prefix_table . '_' . $param;
+            $this->table = $table;
+        }
+    }
+
+    //创建表
+    private function createTable($table){
+        if(! empty($table) && ! Schema::hasTable($table) && Schema::hasTable($this->prefix_table)){
+            //执行建表语句
+            DB::statement('create table '. $table .' like ' . $this->prefix_table);
+        }
+    }
 }

+ 52 - 0
app/Model/OrdersProductProcess.php

@@ -0,0 +1,52 @@
+<?php
+
+namespace App\Model;
+
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Support\Facades\DB;
+use Illuminate\Support\Facades\Schema;
+
+/**
+ *
+ * Class Unit
+ * @package App\Models
+ */
+class OrdersProductProcess extends Model
+{
+    protected  $table = "";
+    protected $prefix_table = 'orders_product_process'; // 对照表
+    const CREATED_AT = 'crt_time';
+    const UPDATED_AT = 'upd_time';
+    protected $dateFormat = 'U';
+    //$fillable属性里面的字段是可以赋值的,其他的所有属性不能被赋值
+    //$guarded属性里面的字段是不可以赋值,其他的所有属性都能被赋值
+    protected $fillable = ['param']; // $attributes 里传参数需要配置这个参数名字
+
+    public function __construct(array $attributes = [])
+    {
+        $param = request()->get('param');
+
+        if(! empty($param)) $this->setTableByParam($param);
+
+        if(isset($attributes['param']) && $attributes['param'] > 0) $this->setTableByParam($attributes['param']);
+
+        $this->createTable($this->table);
+
+        parent::__construct($attributes);
+    }
+
+    public function setTableByParam($param){
+        if($param > 0){
+            $table = $this->prefix_table . '_' . $param;
+            $this->table = $table;
+        }
+    }
+
+    //创建表
+    private function createTable($table){
+        if(! empty($table) && ! Schema::hasTable($table) && Schema::hasTable($this->prefix_table)){
+            //执行建表语句
+            DB::statement('create table '. $table .' like ' . $this->prefix_table);
+        }
+    }
+}

+ 14 - 0
app/Model/SaleOrdersProduct.php

@@ -0,0 +1,14 @@
+<?php
+
+namespace App\Model;
+
+use Illuminate\Database\Eloquent\Model;
+
+class SaleOrdersProduct extends Model
+{
+    protected $table = "sale_orders_product"; //指定表
+    const CREATED_AT = 'crt_time';
+    const UPDATED_AT = 'upd_time';
+    protected $dateFormat = 'U';
+
+}

+ 131 - 0
app/Service/FyyOrderService.php

@@ -0,0 +1,131 @@
+<?php
+
+namespace App\Service;
+
+use App\Model\Orders;
+use App\Model\SaleOrdersProduct;
+use Illuminate\Support\Facades\DB;
+
+class FyyOrderService extends Service
+{
+    public function edit($data){
+        return [true,'保存成功!'];
+    }
+
+    public function setOrderNo(){
+        date_default_timezone_set('PRC');
+        $order_no = date('Ymd') . time() . rand(1000, 9999);
+        return $order_no;
+    }
+
+    public function add($data,$user){
+        //获取数据
+        $sqlServerModel = new FyySqlServerService();
+        list($status,$return,$return_stock_detail) = $sqlServerModel->getDataFromSqlServer($data);
+        if(! $status) return [false, $return];
+
+        //数据校验以及填充
+        list($status,$msg) = $this->orderRule($return);
+        if(!$status) return [$status,$msg];
+
+        try{
+            DB::beginTransaction();
+
+            $keys = array_unique(array_column($return,'out_order_no'));
+            $map = array_fill_keys($keys, 0);
+
+            $orders = $return_stock_detail_map = [];
+            foreach ($return as $key => $value){
+                if(! empty($map[$value['out_order_no']])){
+                    $order_no = $map[$value['out_order_no']];
+                }else{
+                    $order_no = $this->setOrderNo();
+                    $map[$value['out_order_no']] = $order_no;
+
+                    $orders[] = [
+                        'order_no' => $order_no,
+                        'out_order_no' => $value['out_order_no'],
+                        'crt_time' => time()
+                    ];
+                }
+                $return[$key]['order_no'] = $order_no;
+                $return[$key]['crt_id'] = $user['id'];
+                $return[$key]['crt_time'] = time();
+
+//                $keys = $order_no . ($value['technology_name'] ?? '' ) . ;
+            }
+
+            Orders::insert($orders);
+            SaleOrdersProduct::insert($return);
+
+            DB::commit();
+        }catch (\Exception $e){
+            DB::rollBack();
+            return [false,$e->getLine().':'.$e->getMessage()];
+        }
+
+        return [true,'保存成功!'];
+    }
+
+    public function del($data){
+        if($this->isEmpty($data,'id')) return [false,'ID不能为空!'];
+
+        Orders::whereIn('id',$data['id'])->update([
+            'del_time' => time()
+        ]);
+
+        SaleOrdersProduct::where('id',$data['id'])->update([
+            'del_time'=>time()
+        ]);
+
+        return [true,'删除成功'];
+    }
+
+    public function orderDetail($data){
+        return [200,''];
+    }
+
+    public function orderList($data){
+        $model = SaleOrdersProduct::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','product_quantity','technology_material','technology_name','wood_name','process_mark','table_body_mark','out_crt_man','out_checker_man','out_checker_time')
+            ->orderBy('id','desc');
+
+        if(! empty($data['order_no'])) $model->where('order_no', 'LIKE', '%'.$data['order_no'].'%');
+        if(! empty($data['out_order_no'])) $model->where('out_order_no', 'LIKE', '%'.$data['out_order_no'].'%');
+        if(! empty($data['customer_name'])) $model->where('customer_name', 'LIKE', '%'.$data['customer_name'].'%');
+        if(! empty($data['product_title'])) $model->where('product_title', 'LIKE', '%'.$data['product_title'].'%');
+        if(! empty($data['product_size'])) $model->where('product_size', 'LIKE', '%'.$data['product_size'].'%');
+        if(! empty($data['technology_material'])) $model->where('technology_material', 'LIKE', '%'.$data['technology_material'].'%');
+        if(! empty($data['technology_name'])) $model->where('technology_name', 'LIKE', '%'.$data['technology_name'].'%');
+        if(! empty($data['wood_name'])) $model->where('wood_name', 'LIKE', '%'.$data['wood_name'].'%');
+        if(! empty($data['process_mark'])) $model->where('process_mark', 'LIKE', '%'.$data['process_mark'].'%');
+        if(! empty($data['table_header_mark'])) $model->where('table_header_mark', 'LIKE', '%'.$data['table_header_mark'].'%');
+        if(! empty($data['table_body_mark'])) $model->where('table_body_mark', 'LIKE', '%'.$data['table_body_mark'].'%');
+        if(! empty($data['out_checker_man'])) $model->where('out_checker_man', 'LIKE', '%'.$data['out_checker_man'].'%');
+        if(! empty($data['out_crt_man'])) $model->where('out_crt_man', 'LIKE', '%'.$data['out_crt_man'].'%');
+        if(! empty($data['out_checker_time'][0]) && ! empty($data['out_checker_time'][1])) $model->whereBetween('out_checker_time',[$data['out_checker_time'][0],$data['out_checker_time'][1]]);
+        if(! empty($data['out_order_no_time'][0]) && ! empty($data['out_order_no_time'][1])) $model->whereBetween('out_order_no_time',[$data['out_order_no_time'][0],$data['out_order_no_time'][1]]);
+        if(isset($data['status'])) $model->where('status',$data['status']);
+
+        $list = $this->limit($model,'',$data);
+
+        return [true, $list];
+    }
+
+    public function orderRule($data){
+        $result = Orders::where('del_time',0)
+            ->whereIn('out_order_no',array_column($data,'out_order_no'))
+            ->select('out_order_no')
+            ->get()->toArray();
+        if(! empty($result)){
+            $out_order_no_exists = array_column($result,'out_order_no');
+            return [false,'下列销售订单号已存在:'. implode(',',$out_order_no_exists)];
+        }
+
+        return [true,''];
+    }
+
+    public function fyyRefreshOnHandQuantity($data){
+        return [true,''];
+    }
+}

+ 155 - 0
app/Service/FyySqlServerService.php

@@ -0,0 +1,155 @@
+<?php
+
+namespace App\Service;
+
+use Illuminate\Support\Facades\DB;
+
+class FyySqlServerService extends Service
+{
+    public $db = null;
+
+    public function __construct()
+    {
+        $domain_name = $_SERVER['HTTP_HOST'];
+        if(! $this->db) $this->db = DB::connection('sqlsrvs');
+    }
+
+    private function fakeData(){
+        $return = [
+            [
+                'out_order_no' => '001',
+                'out_order_no_time' => 1685928995,
+                'customer_no' => '201603012',
+                'customer_name' => '巴大胡',
+                'table_header_mark' => '表头备注',
+                'product_no' => '产品编码001',
+                'product_title' => '产品名称001',
+                'product_size' => '产品规格30c',
+                'product_unit' => '产品单位米',
+                'product_quantity' => 100,
+                'product_quantity_on_hand' => 50,
+                'technology_material' => '工艺材质',
+                'technology_name' => '工艺名称:同命',
+                'wood_name' => '木皮名称:梭梭树皮',
+                'process_mark' => '加工备注',
+                'table_body_mark' => '表体备注',
+                'out_crt_man' => '外部人员一',
+                'out_checker_man' => '外部人员二',
+                'out_checker_time' => 1685928995,
+            ],
+            [
+                'out_order_no' => '001',
+                'out_order_no_time' => 1685928995,
+                'customer_no' => '201603012',
+                'customer_name' => '巴大胡',
+                'table_header_mark' => '表头备注',
+                'product_no' => '产品编码002',
+                'product_title' => '产品名称002',
+                'product_size' => '产品规格30d',
+                'product_unit' => '产品单位米',
+                'product_quantity' => 100,
+                'product_quantity_on_hand' => 50,
+                'technology_material' => '工艺材质',
+                'technology_name' => '工艺名称:同命',
+                'wood_name' => '木皮名称:梭梭树皮',
+                'process_mark' => '加工备注',
+                'table_body_mark' => '表体备注',
+                'out_crt_man' => '外部人员一',
+                'out_checker_man' => '外部人员二',
+                'out_checker_time' => 1685928995,
+            ],
+            [
+                'out_order_no' => '002',
+                'out_order_no_time' => 1685928995,
+                'customer_no' => '201603012',
+                'customer_name' => '巴大胡',
+                'table_header_mark' => '表头备注',
+                'product_no' => '产品编码002',
+                'product_title' => '产品名称002',
+                'product_size' => '产品规格30d',
+                'product_unit' => '产品单位米',
+                'product_quantity' => 100,
+                'product_quantity_on_hand' => 50,
+                'technology_material' => '工艺材质',
+                'technology_name' => '工艺名称:同命',
+                'wood_name' => '木皮名称:梭梭树皮',
+                'process_mark' => '加工备注',
+                'table_body_mark' => '表体备注',
+                'out_crt_man' => '外部人员一',
+                'out_checker_man' => '外部人员二',
+                'out_checker_time' => 1685928995,
+            ],
+        ];
+        return $return;
+    }
+
+    //获取数据
+    public function getDataFromSqlServer($data){
+        if(empty($data['out_order_no_time'][0]) || empty($data['out_order_no_time'][1])) return [false,'制单日期不能为空!'];
+
+        //查询产品主表副表数据
+        date_default_timezone_set("PRC");
+        $start = date('Y-m-d H:i:s.000',$data['out_order_no_time'][0]);
+        $end = date('Y-m-d H:i:s.000',$data['out_order_no_time'][1]);
+        $result = $this->db->table('SO_SOMain as a')
+            ->leftJoin('SO_SODetails as b','b.cSOCode','a.cSOCode')
+            ->whereBetween('a.dDate',[$start, $end])
+            ->select('a.cSOCode as out_order_no','a.dDate as out_order_no_time','a.cCusCode as customer_no','a.cCusName as customer_name','a.cMemo as table_header_mark','a.cMaker as out_crt_man','a.cVerifier as out_checker_man','a.dverifydate as out_checker_time','b.cInvCode as product_no','b.iQuantity as product_quantity','b.cDefine28 as technology_material','b.cFree1 as technology_name','b.cFree2 as wood_name','b.cDefine30 as process_mark','b.cMemo as table_body_mark')
+            ->get()->toArray();
+        if(empty($result)) return [false,'暂无数据,更新结束!'];
+
+        //查询附带的一些信息(比较少)
+        $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');
+
+        //组织查询条件
+        $args = '';
+        foreach ($result as $value){
+            $product = $value->product_no;
+            $technology_name = $value->technology_name ?? '';
+            $wood_name = $value->wood_name ?? '';
+            $args .= "(a.cInvCode = '{$product}' and a.cFree1 = '{$technology_name}' and a.cFree2 = '{$wood_name}') OR ";
+        }
+        $args = rtrim($args,'OR ');
+
+        $messageTwo = $this->db->table('CurrentStock as a')
+            ->leftJoin('Warehouse as b','b.cWhCode','a.cWhCode')
+            ->whereRaw("($args)")
+            ->where('a.iQuantity','>',0)
+            ->select('a.iQuantity as product_quantity_on_hand','a.cInvCode as product_no','a.cFree1 as technology_name','a.cFree2 as wood_name','b.cWhName as warehouse_name')
+            ->get()->toArray();
+
+        $messageTwoTotal = [];
+        if(! empty($messageTwo)){
+            foreach ($messageTwo as $key => $value){
+                $keys = $value->product_no . $value->technology_name . $value->wood_name;
+                if(isset($messageTwoTotal[$keys])){
+                    $messageTwoTotal[$keys] += $value->product_quantity_on_hand;
+                }else{
+                    $messageTwoTotal[$keys] = $value->product_quantity_on_hand;
+                }
+
+                $messageTwo[$key] = (array)$value;
+            }
+        }
+
+        foreach ($result as $key => $value){
+            $keys = $value->product_no . $value->technology_name . $value->wood_name;
+            $result[$key]->product_title = $messageMap[$value->product_no]->product_title ?? '';
+            $result[$key]->product_size = $messageMap[$value->product_no]->product_size ?? '';
+            $result[$key]->product_unit = $messageMap[$value->product_no]->product_unit ?? '';
+            $result[$key]->product_quantity_on_hand = $messageTwoTotal[$keys] ?? 0;
+            $result[$key] = (array)$value;
+        }
+
+        return [true,$result,$messageTwo];
+    }
+}

+ 153 - 0
app/Service/ProductionOrderService.php

@@ -0,0 +1,153 @@
+<?php
+
+namespace App\Service;
+
+use App\Model\OrdersProduct;
+use App\Model\OrdersProductBom;
+use App\Model\OrdersProductProcess;
+use App\Model\Process;
+use App\Model\SaleOrdersProduct;
+use Illuminate\Support\Facades\DB;
+
+/**
+ * bom相关
+ * @package App\Models
+ */
+class ProductionOrderService extends Service
+{
+    public function edit($data){}
+
+    public function setOrderNO(){
+        $str = date('Ymd',time());
+
+        $order_number = OrdersProduct::where('production_no','Like','%'. $str . '%')
+            ->max('order_number');
+
+        if(empty($order_number)){
+            $number = str_pad(1,3,'0',STR_PAD_LEFT);
+            $number = $str . $number;
+        }else{
+            $tmp = substr($order_number, -3);
+            $tmp = $tmp + 1;
+
+            //超过99999
+            if(strlen($tmp) > 3) return '';
+
+            $number = str_pad($tmp,3,'0',STR_PAD_LEFT);
+            $number = $str . $number;
+        }
+
+        return $number;
+    }
+
+    public function add($data,$user){
+        //数据校验以及填充
+        list($status,$msg) = $this->orderRule($data);
+        if(!$status) return [$status,$msg];
+
+        $production_no = $this->setOrderNO();
+
+        //工序
+        $process = Process::where('del_time',0)
+            ->orderBy('id','desc')
+            ->first();
+        if(empty($process)) return [false,'工序不存在!'];
+
+        try{
+            DB::beginTransaction();
+
+            $result = SaleOrdersProduct::whereIn('id',$data['id'])
+                ->select('order_no','out_order_no','out_order_no_time','customer_no','customer_name','table_header_mark','product_no','product_title','product_size','product_unit','product_quantity','technology_material','technology_name','wood_name','process_mark','table_body_mark','out_crt_man','out_checker_man','out_checker_time')->get()->toArray();
+
+            $boom = $process = [];
+            $time = time();
+            foreach ($result as $key => $value){
+                $result[$key]['production_no'] = $production_no;
+                $result[$key]['production_quantity'] = $data['quantity'][$key];
+                $result[$key]['production_time'] = $time;
+
+                foreach ($data['quantity'][$key] as $v){
+                    $boom[$value['order_no']][] = [
+                        'order_no' => $value['order_no'],
+                        'out_order_no' => $value['out_order_no'],
+                        'product_no' => $value['product_no'],
+                        'product_title' => $value['product_title'],
+                        'crt_time' => $time
+                    ];
+
+                    $process[$value['order_no']][] = [
+                        'process_id' => $process->id,
+                        'order_no' => $value['order_no'],
+                        'out_order_no' => $value['out_order_no'],
+                        'product_no' => $value['product_no'],
+                        'product_title' => $value['product_title'],
+                        'crt_time' => $time
+                    ];
+                }
+
+            }
+
+            OrdersProduct::insert($result);
+
+            foreach ($boom as $key => $value){
+                $boom = new OrdersProductBom(['param' => $key]);
+                $boom->insert($value);
+            }
+
+            foreach ($process as $key => $value){
+                $boom = new OrdersProductProcess(['param' => $key]);
+                $boom->insert($value);
+            }
+
+            DB::commit();
+        }catch (\Exception $e){
+            DB::rollBack();
+            return [false,$e->getLine().':'.$e->getMessage()];
+        }
+
+        return [true,'保存成功!'];
+    }
+
+    public function del($data){
+        if($this->isEmpty($data,'id')) return [false,'ID不能为空!'];
+
+        return [true,'删除成功'];
+    }
+
+    public function orderDetail($data){
+        return [200,''];
+    }
+
+    public function orderList($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','product_quantity','technology_material','technology_name','wood_name','process_mark','table_body_mark','out_crt_man','out_checker_man','out_checker_time','production_quantity','production_quantity','production_no','status')
+            ->orderBy('id','desc');
+
+        if(! empty($data['order_no'])) $model->where('order_no', 'LIKE', '%'.$data['order_no'].'%');
+        if(! empty($data['out_order_no'])) $model->where('out_order_no', 'LIKE', '%'.$data['out_order_no'].'%');
+        if(! empty($data['customer_name'])) $model->where('customer_name', 'LIKE', '%'.$data['customer_name'].'%');
+        if(! empty($data['product_title'])) $model->where('product_title', 'LIKE', '%'.$data['product_title'].'%');
+        if(! empty($data['product_size'])) $model->where('product_size', 'LIKE', '%'.$data['product_size'].'%');
+        if(! empty($data['technology_material'])) $model->where('technology_material', 'LIKE', '%'.$data['technology_material'].'%');
+        if(! empty($data['technology_name'])) $model->where('technology_name', 'LIKE', '%'.$data['technology_name'].'%');
+        if(! empty($data['wood_name'])) $model->where('wood_name', 'LIKE', '%'.$data['wood_name'].'%');
+        if(! empty($data['process_mark'])) $model->where('process_mark', 'LIKE', '%'.$data['process_mark'].'%');
+        if(! empty($data['table_header_mark'])) $model->where('table_header_mark', 'LIKE', '%'.$data['table_header_mark'].'%');
+        if(! empty($data['table_body_mark'])) $model->where('table_body_mark', 'LIKE', '%'.$data['table_body_mark'].'%');
+        if(! empty($data['out_checker_man'])) $model->where('out_checker_man', 'LIKE', '%'.$data['out_checker_man'].'%');
+        if(! empty($data['out_checker_time'])) $model->where('out_checker_time', $data['out_checker_time']);
+        if(! empty($data['out_crt_man'])) $model->where('out_crt_man', 'LIKE', '%'.$data['out_crt_man'].'%');
+        if(! empty($data['out_order_no_time'])) $model->where('out_order_no_time', $data['out_order_no_time']);
+        if(isset($data['status'])) $model->where('status',$data['status']);
+
+        $list = $this->limit($model,'',$data);
+
+        return [200,$list];
+    }
+
+    public function orderRule($data){
+        if($this->isEmpty($data,'id')) return [false,'请选择数据!'];
+
+        return [true,''];
+    }
+}