Эх сурвалжийг харах

系统合并,工艺引用

qiuenguang 1 жил өмнө
parent
commit
657cf39163

+ 1 - 1
application/api/config.php

@@ -3,5 +3,5 @@
 //配置文件
 return [
     'exception_handle'        => '\\app\\api\\library\\ExceptionHandle',
-    'product_code_digit'    => 5,//成品编码位数
+    'product_code_digit'    => 4,//成品编码位数
 ];

+ 28 - 21
application/api/controller/WorkOrder.php

@@ -34,7 +34,7 @@ class WorkOrder extends Api
         if (isset($param['sort'])){
             $where['工单分类'] = 2;
         }else{
-            $where['工单分类'] = 1;
+            $where['工单分类'] = ['in',[1,3]];
         }
         $where['行号'] = ['in',['1','10']];
         //获取总计划中数量和总生产中数量
@@ -43,7 +43,7 @@ class WorkOrder extends Api
         $data = [
             'productingAll' => $productingAll,
             'progressAll' => $progressAll,
-            '客户编号' => []
+//            '客户编号' => []
         ];
         $list = \db('产品_基本资料')
             ->where('客户编号','<>','')
@@ -54,6 +54,7 @@ class WorkOrder extends Api
         if (empty($list)){
             $this->success('',[]);
         }
+        $data['翌星工单']=$data['MN工单']=[];
         foreach ($list as $key=>$value){
             $value['客户编号'] = rtrim($value['客户编号']);
             //这条sql查出来的数据可能不对,试一下以下sql
@@ -67,13 +68,13 @@ class WorkOrder extends Api
                 $string = $string."计划中:".$proGress;
             }
             if ($string !== ''){
-                $name = $value['客户编号'].'【'.$string.'】'.$value['客户名称'];
-//                if (strpos($value['客户编号'],'J') !== false){
-//                    array_push($data['糊盒工单'],$name);
-//                }else{
-//                    array_push($data['印刷工单'],$name);
-//                }
-                array_push($data['客户编号'],$name);
+                $name = $value['客户编号'].'【'.$string.'】'.rtrim($value['客户名称']);
+                if (strpos($value['客户编号'],'J') !== false || strpos($value['客户编号'],'Y') !== false){
+                    array_push($data['翌星工单'],$name);
+                }else{
+                    array_push($data['MN工单'],$name);
+                }
+//                array_push($data['客户编号'],$name);
             }
 //            else{
 //                $name = $value['客户编号'].$value['客户名称'];
@@ -116,17 +117,21 @@ class WorkOrder extends Api
         }
         $where = [];
         if (!empty($clientNumber)){
+            if (substr($clientNumber,0,1) !== 'Y' && substr($clientNumber,0,1) !== 'J')
+            {
+                $clientNumber = substr($clientNumber,0,4);
+            }
             if ($clientNumber === 'Y1401'){
                 $where['Gd_cpdh'] = ['like',$clientNumber.'%'];
             }else{
                 $where['成品代号'] = ['like',$clientNumber.'%'];
             }
         }
-        if (substr($clientNumber,0,1) === 'Y'){
-            $where['工单分类'] = 1;
-        }elseif (substr($clientNumber,0,1) === 'J'){
-            $where['工单分类'] = 2;
-        }
+//        if (substr($clientNumber,0,1) === 'Y'){
+//            $where['工单分类'] = 1;
+//        }elseif (substr($clientNumber,0,1) === 'J'){
+//            $where['工单分类'] = 2;
+//        }
         if (!empty($workOrder)){
             $where['Gd_gdbh'] = $workOrder;
         }
@@ -139,7 +144,7 @@ class WorkOrder extends Api
         if (!empty($startTime) && !empty($endTime)){
             $where['接单日期'] = ['between',[$startTime,$endTime]];
         }
-        $where['工单分类'] = $sort;
+//        $where['工单分类'] = $sort;
 //        $where['行号'] = ['in',['1','10']];
         $total = \db('工单_基本资料')->where($where)->distinct(true)->field('Gd_gdbh')->count();
         $list = \db('工单_基本资料')
@@ -2151,10 +2156,10 @@ class WorkOrder extends Api
         }
         if (isset($param['sort'])){
             $priWhere['yj_yjno'] = ['>=',10];
-            $proWhere['Gy0_yjno'] = ['>=',10];
+            $proWhere['a.Gy0_yjno'] = ['>=',10];
         }else{
             $priWhere['yj_yjno'] = ['<',10];
-            $proWhere['Gy0_yjno'] = ['<',10];
+            $proWhere['a.Gy0_yjno'] = ['<',10];
         }
         $list = \db('工单_基本资料')
             ->where('Gd_gdbh',$param['workorder'])
@@ -2205,16 +2210,18 @@ class WorkOrder extends Api
         }
         //引用工艺资料
         $processWhere = [
-            'Gy0_方案' => $param['option'],
-            'Gy0_cpdh' => $param['productCode']
+            'a.Gy0_方案' => $param['option'],
+            'a.Gy0_cpdh' => $param['productCode']
         ];
         $yjnolist = \db('工单_基本资料')
             ->where('Gd_gdbh',$param['workorder'])
-            ->column('行号');
+            ->column('Gd_cpdh');
         $ProcessList = \db('产品_工艺资料')
+            ->alias('a')
+            ->join('产品_印件资料 b','a.Gy0_cpdh = b.yj_cpdh AND a.Gy0_yjno = yj_yjno')
             ->where($processWhere)
             ->where($proWhere)
-            ->whereIn('Gy0_yjno',$yjnolist)
+            ->whereIn('b.yj_yjdh',$yjnolist)
             ->order('Gy0_yjno,Gy0_gxh')
             ->select();
         if (empty($ProcessList)){