cqp 1 сар өмнө
parent
commit
fbda516f2f

+ 13 - 0
app/Http/Controllers/Api/ApplyOrderController.php

@@ -203,4 +203,17 @@ class ApplyOrderController extends BaseController
             return $this->json_return(201,$data);
         }
     }
+
+    public function getReportRate(Request $request)
+    {
+        $service = new ApplyOrderService();
+        $userData = $request->userData->toArray();
+        list($status,$data) = $service->getReportRate($request->all(), $userData);
+
+        if($status){
+            return $this->json_return(200,'',$data);
+        }else{
+            return $this->json_return(201,$data);
+        }
+    }
 }

+ 2 - 0
app/Model/ApplyOrder.php

@@ -21,6 +21,7 @@ class ApplyOrder extends Model
     const type_three = 3;
     const type_four = 4;
     const type_five = 5;
+    const type_six = 6;
 
     public static $type_name = [
         self::type_one => '领料申请单',
@@ -28,6 +29,7 @@ class ApplyOrder extends Model
         self::type_three => '包装入库申请单',
         self::type_four => '包装领料申请单',
         self::type_five => '质检入库申请单',
+        self::type_six => '半成品出库申请单',
     ];
 
     const state_zero = 0;

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 535 - 63
app/Service/ApplyOrderService.php


+ 58 - 3
app/Service/Box/BoxService.php

@@ -231,7 +231,6 @@ class BoxService extends Service
             //包装单
             $package_data = $msg->toArray();
 
-
             $dispatch_list = $msg1 ?? [];
             if(! empty($dispatch_list)){
                 foreach ($dispatch_list as $key => $value){
@@ -249,6 +248,14 @@ class BoxService extends Service
                 ->select('ext_1 as product_no', 'ext_3 as technology_name', 'ext_8 as product_title', 'ext_9 as product_size', 'num as quantity')
                 ->get()->toArray();
 
+            //生成半成品出库申请单
+            list($status, $msg1) = $this->createbcpllSQ($package_data,$boxDetail, $user);
+            if(! $status) {
+                $this->dellimitingSendRequestBackgNeed($limit_key);
+                DB::rollBack();
+                return [false, $msg1];
+            }
+
             //生成包装领料申请单
             list($status, $msg1) = $this->createllSQ($package_data,$boxDetail, $user);
             if(! $status) {
@@ -311,6 +318,54 @@ class BoxService extends Service
         }
     }
 
+    public function createbcpllSQ($package_data, $insert_id, $user){
+        //是否自动审核  半成品出库申请单
+        $em = new EmployeeService();
+        $auto = $em->is_auto($user,"bcpckllsq_auto");
+
+        //组织包装原材料写入数据
+        $insert = [];
+        $box_id = $package_data['id'] ?? 0;
+        foreach ($insert_id as $value){
+            $insert[] = [
+                'id' => $box_id,
+                'quantity' => $value['quantity'] ?? 0,
+                'product_no' => $value['product_no'],
+                'product_title' => $value['product_title'],
+                'product_size' => "",
+                'product_unit' => "",
+            ];
+        }
+
+        try {
+            DB::beginTransaction();
+
+            //生成申请单
+            $service = new ApplyOrderService();
+            list($status, $msg) = $service->createSQ($insert, $user, ApplyOrder::type_six, $auto);
+            if(! $status) {
+                DB::rollBack();
+                return [false, $msg];
+            }
+
+            if($auto) {
+                //生成流水
+                list($status, $msg) = $service->createRecord($msg);
+                if(! $status) {
+                    DB::rollBack();
+                    return [false, $msg];
+                }
+            }
+
+            DB::commit();
+        }catch (\Throwable $exception){
+            DB::rollBack();
+            return [false, $exception->getFile() . $exception->getMessage() . $exception->getLine()];
+        }
+
+        return [true, ''];
+    }
+
     public function createllSQ($package_data, $insert_id, $user){
         //是否自动审核  包装领料申请单
         $em = new EmployeeService();
@@ -968,8 +1023,8 @@ class BoxService extends Service
             $service->writeFinishedQuantity($id);
 
             //生成完工入库申请单
-            list($status, $msg) = $this->createWGSQ($last_update, $user);
-            if(! $status) return [false, $msg];
+//            list($status, $msg) = $this->createWGSQ($last_update, $user);
+//            if(! $status) return [false, $msg];
 
             //生成报工单
             $service = new FinishedOrderService();

+ 2 - 2
app/Service/DispatchService.php

@@ -116,7 +116,7 @@ class DispatchService extends Service
             $product_no = array_unique(array_column($insert_data,'product_no'));
             //获取原料
             $service = new FyyOrderService();
-            list($status, $msg) = $service->getProductDataFromSqlServer(['product_no' => $product_no], $user);
+            list($status, $msg) = $service->getProductDataFromSqlServer(['product_no' => $product_no, 'type'=> 1], $user);
             if($status) $return = $msg;
 
             //组织原材料写入数据
@@ -923,7 +923,7 @@ class DispatchService extends Service
         if(! empty($erg['material'])){
             $product_no = array_unique(array_column($data['data'],'product_no'));
             $service = new FyyOrderService();
-            list($status, $msg) = $service->getProductDataFromSqlServer(['product_no' => $product_no], $user);
+            list($status, $msg) = $service->getProductDataFromSqlServer(['product_no' => $product_no, 'type' => 1], $user);
             if($status) $return = $msg;
         }
 

+ 4 - 4
app/Service/FinishedOrderService.php

@@ -331,9 +331,9 @@ class FinishedOrderService extends Service
             $this->writeFinishedQuantity($id);
 
             //生成完工入库申请单
-            $service = new BoxService();
-            list($status, $msg) = $service->createWGSQ($last_update, $user);
-            if(! $status) return [false, $msg];
+//            $service = new BoxService();
+//            list($status, $msg) = $service->createWGSQ($last_update, $user);
+//            if(! $status) return [false, $msg];
 
             //生成报工单
             list($status, $msg) = $this->createbg($last_update2, $user);
@@ -1517,7 +1517,7 @@ class FinishedOrderService extends Service
             $model->where('b.dispatch_time_start','>=',$data['dispatch_time'][0]);
             $model->where('b.dispatch_time_end','<=',$data['dispatch_time'][1]);
         }
-        if(! empty($data['id'])) $model->where('b.id',$data['id']);
+        if(! empty($data['pc_number'])) $model->where('b.out_order_no', 'LIKE', '%'.$data['out_order_no'].'%');
         if(! empty($data['team_id'])) $model->where('b.team_id',$data['team_id']);
         if(! empty($data['device_id'])) $model->where('b.device_id',$data['device_id']);
         if(! empty($data['equipment_id'])) $model->where('b.device_id',$data['equipment_id']);

+ 21 - 0
app/Service/FyyOrderService.php

@@ -487,6 +487,27 @@ class FyyOrderService extends Service
     }
 
     public function getProductDataFromSqlServer($data,$user){
+        $result = [];
+        foreach ($data['product_no'] as $value){
+            if(! empty($data['type'])){
+                $result[$value][] = [
+                    'product_no' => "010001",
+                    'product_title' => "片料",
+                    'product_size' => "",
+                    'product_unit' => "",
+                ];
+            }else{
+                $result[$value][] = [
+                    'product_no' => "010011",
+                    'product_title' => "浮料",
+                    'product_size' => "",
+                    'product_unit' => "",
+                ];
+            }
+        }
+
+        return [true, $result];
+
         $sqlServerModel = new FyySqlServerService($user);
         if($sqlServerModel->error) return [false,$sqlServerModel->error];
 

+ 4 - 0
app/Service/ProcessService.php

@@ -104,6 +104,8 @@ class ProcessService extends Service
         $model->team_id = $data['team_id'] ?? 0;
         $model->device_id = $data['device_id'] ?? 0;
         $model->is_need_remain = $data['is_need_remain'] ?? 0;
+        $model->zj_type = $data['zj_type'] ?? 0;
+        $model->zj_rate = $data['zj_rate'] ?? 0;
         $model->save();
 
         return [true,'保存成功!'];
@@ -126,6 +128,8 @@ class ProcessService extends Service
         $model->team_id = $data['team_id'] ?? 0;
         $model->device_id = $data['device_id'] ?? 0;
         $model->is_need_remain = $data['is_need_remain'] ?? 0;
+        $model->zj_type = $data['zj_type'] ?? 0;
+        $model->zj_rate = $data['zj_rate'] ?? 0;
         $model->save();
 
         return [true,'保存成功!'];

+ 6 - 0
app/Service/ScrappService.php

@@ -94,7 +94,13 @@ class ScrappService extends Service
 
     //质检单
     public function zjList($data, $user){
+        $process = Process::where('del_time',0)
+            ->where('is_need_remain',1)
+            ->pluck('id')
+            ->toArray();
+
         $model = ScrappCount::where('del_time',0)
+            ->whereIn('process_id', $process)
             ->select('*')
             ->orderBy('order_number','desc');
 

+ 1 - 0
routes/api.php

@@ -305,6 +305,7 @@ Route::group(['middleware'=> ['checkLogin']],function ($route){
     //报工单质检
     $route->any('qualityTesting', 'Api\ApplyOrderController@qualityTesting');
     $route->any('orderSearchList', 'Api\ApplyOrderController@orderSearchList');
+    $route->any('getReportRate', 'Api\ApplyOrderController@getReportRate');
 
     $route->any('systemDataList','Api\ScreenController@systemDataList');
 });

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно