Ver Fonte

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

曹鹤洋 há 1 ano atrás
pai
commit
1db7457d35

+ 49 - 4
application/api/controller/Facility.php

@@ -955,15 +955,16 @@ class Facility extends Api
         if ($this->request->isGet() === false){
             $this->error('请求错误');
         }
-        $date = date('Y-m-d 00:00:00',time()-3888000);
+        $date = date('Y-m-d 00:00:00',time()-3456000);
         $nowTime = date('Y-m-d H:i:s',time());
         $list = \db('设备_基本资料')->where('使用状态',1)->order('设备编号')->column('设备编号');
         if (empty($list)){
             $this->error('失败');
         }
-        $sql = "SELECT RTRIM(a.`设备编号`) as `设备编号`,RTRIM(b.`日期`) as `日期`,RTRIM(b.UniqId) as UniqId FROM `设备_基本资料` as a 
+        $sql = "SELECT RTRIM(a.`设备编号`) as `设备编号`,RTRIM(b.`日期`) as `日期`,RTRIM(b.UniqId) as UniqId 
+                FROM `设备_基本资料` as a 
                 LEFT JOIN `制程_换型清场` as b ON b.`机台编号` = a.`设备编号`
-                WHERE b.`日期` > '{$date}' AND b.日期 < '{$nowTime}' ORDER BY b.`UniqId`";
+                WHERE b.`日期` > '{$date}' AND b.日期 < '{$nowTime}' AND b.`工单编号A` <> '' AND b.`工单编号B` <> '' ORDER BY b.`UniqId`";
         $res = Db::query($sql);
         $data = $result = [];
         foreach ($list as $key=>$value){
@@ -1021,6 +1022,7 @@ class Facility extends Api
         }
         $list['日期'] = date('Y-m-d',strtotime($list['日期']));
         $list['印件名称A'] = \db('工单_印件资料')->where('Yj_Gdbh',$list['工单编号A'])->field('rtrim(yj_yjmc) as yjmc')->find()['yjmc'];
+//        if ()
         $list['印件名称B'] = \db('工单_印件资料')->where('Yj_Gdbh',$list['工单编号B'])->field('rtrim(yj_yjmc) as yjmc')->find()['yjmc'];
         $this->success('成功',$list);
     }
@@ -1047,7 +1049,9 @@ class Facility extends Api
         $nowTime = date('Y-m-d H:i:s',time());
         $where = [
             '日期' =>['between',[$date,$nowTime]],
-            '机台编号' => $param['machine']
+            '机台编号' => $param['machine'],
+            '工单编号A' => ['<>',''],
+            '工单编号B' => ['<>',''],
         ];
         $field = "rtrim(日期) as 日期,rtrim(机台编号) as 机台编号,rtrim(班组) as 班组,rtrim(工单编号A) as 工单编号A,rtrim(印件工序A) as 印件工序A,
         rtrim(码包号A) as 码包号A,rtrim(工单编号B) as 工单编号B,rtrim(印件工序B) as 印件工序B,rtrim(码包号B) as 码包号B,rtrim(清场项目A) as 清场项目A,
@@ -1551,4 +1555,45 @@ class Facility extends Api
             $this->success('设置成功');
         }
     }
+
+    //首页数据
+
+    public function index()
+    {
+        $data = [
+            'workOrderData' => [
+                '计划中' => 100,
+                '排程中' => 100,
+                '制程中' => 100,
+                '已完工' => 100,
+            ],
+            'MonthlyData' => [
+                '1' => 100,
+                '2' => 100,
+                '3' => 100,
+                '4' => 100,
+                '5' => 100,
+                '6' => 100,
+                '7' => 100,
+                '8' => 100,
+                '9' => 100,
+                '10' => 100,
+                '11' => 100,
+                '12' => 100,
+            ],
+            'customer' => [
+                '0' => ['包装用牛皮纸松,无法上高速机,烟厂手动加纸','2024-02-26'],
+                '1' => ['包装用牛皮纸松,无法上高速机,烟厂手动加纸','2024-02-26'],
+                '2' => ['包装用牛皮纸松,无法上高速机,烟厂手动加纸','2024-02-26'],
+                '3' => ['包装用牛皮纸松,无法上高速机,烟厂手动加纸','2024-02-26'],
+                '4' => ['包装用牛皮纸松,无法上高速机,烟厂手动加纸','2024-02-26'],
+                '5' => ['包装用牛皮纸松,无法上高速机,烟厂手动加纸','2024-02-26'],
+                '6' => ['包装用牛皮纸松,无法上高速机,烟厂手动加纸','2024-02-26'],
+                '7' => ['包装用牛皮纸松,无法上高速机,烟厂手动加纸','2024-02-26'],
+                '8' => ['包装用牛皮纸松,无法上高速机,烟厂手动加纸','2024-02-26'],
+                '9' => ['包装用牛皮纸松,无法上高速机,烟厂手动加纸','2024-02-26'],
+            ],
+        ];
+        return json($data);
+    }
 }

+ 1 - 2
application/api/controller/OrderSuperLoss.php

@@ -492,7 +492,7 @@ class OrderSuperLoss extends Api
                     'a.Gy0_gdbh' => $order,
                     'a.Gy0_gxh' => ['in', $gxh_values]
                 ])
-                ->group('b.sczl_gxh, b.sczl_bh1, b.sczl_bh2, b.sczl_bh3, b.sczl_bh4, c.sczl_bh')
+                ->group('b.sczl_gxh, b.sczl_bh1, b.sczl_bh2, b.sczl_bh3, b.sczl_bh4,b.sczl_bh5,b.sczl_bh6,b.sczl_bh7,b.sczl_bh8,b.sczl_bh9,b.sczl_bh10, c.sczl_bh')
                 ->order('a.Gy0_gxh, b.UniqId DESC, c.UniqId DESC')
                 ->select();
             foreach ($gy_data as $key=>$value){
@@ -554,7 +554,6 @@ class OrderSuperLoss extends Api
                         array_push($nameArr,$name);
                     }
                 }
-
                 $gy_data[$key]['member'] = implode(' ',$nameArr);
                 unset($gy_data[$key]['Gy0_计划损耗']);
                 unset($gy_data[$key]['gxmc']);

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

@@ -1428,20 +1428,38 @@ class WorkOrder extends Api
         if ($this->request->isGet() === false){
             $this->error('请求错误');
         }
-        $sql = "SELECT DISTINCT
+        $param = $this->request->param();
+        if (isset($param['search'])){
+            $where = $param['search'].'%';
+            $sql = "SELECT DISTINCT
+                        (客户编号),rtrim(客户名称 ) as 客户名称
+                    FROM
+                        `产品_基本资料`
+                    WHERE
+                        客户编号 LIKE "."'".$where."'"."
+                    OR
+                        客户名称 LIKE "."'".$where."'"."
+                    GROUP BY
+                        客户编号
+                    order by
+                        客户编号";
+        }else{
+            $sql = "SELECT DISTINCT
                     (客户编号),rtrim(客户名称 ) as 客户名称
                 FROM
-                    `产品_基本资料` 
+                    `产品_基本资料`
                 GROUP BY
                     客户编号
-                order by 
+                order by
                     客户编号";
+        }
         $list = \db()->query($sql);
         if (empty($list)){
             $this->success('未找到客户列表');
         }
         foreach ($list as $key=>$value){
             $list[$key]['客户编号'] = rtrim($value['客户编号']);
+            $list[$key]['name'] = rtrim($value['客户编号']).'【'.$value['客户名称'].'】';
             if ($value['客户编号'] == '1098'){
                 $list[$key]['客户名称'] = '打样专用';
             }
@@ -1464,16 +1482,20 @@ class WorkOrder extends Api
             $this->error('请求错误');
         }
         $param = $this->request->param();
-        if (empty($param)){
+        if (isset($param['cilent']) === false){
             $this->error('参数错误');
         }
+        $where = ['产品编号'=>['like',$param['cilent'].'%']];
         $list = \db('产品_基本资料')
-            ->where('客户编号',$param['cilent'])
+            ->where($where)
             ->field('rtrim(产品编号) as 产品编号,rtrim(产品名称) as 产品名称')
             ->select();
         if (empty($list)){
             $this->success('未获取到产品数据');
         }
+        foreach ($list as $key=>$value){
+            $list[$key]['name'] = $value['产品编号'].'【'.$value['产品名称'].'】';
+        }
         $this->success('成功',$list);
     }