Browse Source

Merge branch 'master' of https://git.7in6.com/liuhairui/mes-dc-server-api

zck 2 days ago
parent
commit
b3ab3186df

+ 1 - 1
application/api/controller/Staff.php

@@ -230,7 +230,7 @@ class Staff extends Api
         }
 
         // 查询数据库是否已存在
-        $Find_list = Db::name('人员_基本资料')->where('staff_no', $staff_no)->find();
+        $Find_list = Db::name('人员_基本资料')->where('staff_no', $staff_no)->whereNull('mod_rq')->find();
         if($Find_list){
             $this->error('员工编号已存在');
         }

+ 2 - 5
application/api/controller/WorkOrder.php

@@ -2049,6 +2049,7 @@ class WorkOrder extends Api
             ->order('a.UNIQID desc')
             ->select();
 
+
         if (!empty($list)) {
             // 获取去重后的物料名称
             $materialNames = array_column($list, '物料名称');
@@ -2778,8 +2779,6 @@ class WorkOrder extends Api
 
     public function Gpt($massage)
     {
-//        $apiKey = 'sk-e0JuPjMntkbgi1BoMjrqyyzMKzAxILkQzyGMSy3xiMupuoWY';
-//        $apiKey = 'sk-Bhos1lXTRpZiAAmN06624a219a874eCd91Dc068b902a3e73';
         $apiKey = 'sk-fxlawqVtbbQbNW0wInR3E4wsLo5JHozDC2XOHzMa711su6ss';
         $messages = [
             [
@@ -2788,15 +2787,13 @@ class WorkOrder extends Api
             ]
         ];
         $data = [
-            'model' => 'gpt-4',
+            'model' => 'gpt-4.1',
             'messages' => $messages,
             'max_tokens' => 1024,
             'temperature' => 0.7,
         ];
 
         // 初始化 cURL 请求
-//        $ch = curl_init('https://niubi.zeabur.app/v1/chat/completions');
-//        $ch = curl_init('https://one.opengptgod.com/v1/chat/completions');
         $ch = curl_init('https://chatapi.onechats.top/v1/chat/completions');
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
         curl_setopt($ch, CURLOPT_HTTPHEADER, [

+ 5 - 21
application/api/controller/WorkOrderProcess.php

@@ -361,42 +361,26 @@ class WorkOrderProcess extends Api
         if (empty($params['big_process'])) {
             $this->error('大工艺不能为空');
         }
-        // if (empty($params['standard_hour'])) {
-        //     $this->error('标准工时不能为空');
-        // }
-        // if (empty($params['standard_score'])) {
-        //     $this->error('标准公分不能为空');
-        // // }
-        // if (empty($params['coefficient'])) {
-        //     $params['coefficient'] = 'C';
-        // }
         if (empty($params['sys_id'])) {
             $this->error('系统人不能为空');
         }
 
-        // 检查是否传入了process_code
         if (!empty($params['process_code'])) {
-            $code = $params['process_code'];
-            // 检查是否存在冲突
+            $code = intval($params['process_code']);
             $exists = db('工单_基础工艺资料')
                 ->where('work_order', $params['workorder'])
                 ->where('part_code', $params['part_code'])
-                ->where('process_code', '>=', $code)
+                ->where('process_code', $code)
+                ->whereNull('del_rq')
                 ->count();
-
             if ($exists > 0) {
-                // 如果存在冲突,将后续编号自动加1
-                db('工单_基础工艺资料')
-                    ->where('work_order', $params['workorder'])
-                    ->where('part_code', $params['part_code'])
-                    ->where('process_code', '>=', $code)
-                    ->setInc('process_code');
+                $this->error('工序编号已存在');
             }
         } else {
-            // 如果没有传入process_code,按照原来的逻辑生成
             $code = db('工单_基础工艺资料')
                 ->where('work_order', $params['workorder'])
                 ->where('part_code', $params['part_code'])
+                ->whereNull('del_rq')
                 ->max('process_code');
             $code = $code ? $code + 1 : 1;
         }