qiuenguang 1 年間 前
コミット
54827f8d20

+ 35 - 25
application/api/controller/Facility.php

@@ -93,6 +93,7 @@ class Facility extends Api
         $productName = Db::table('工单_基本资料')->whereIn('Gd_gdbh',$Gd_gdbh)->column('Gd_cpmc','Gd_gdbh');
         //组员信息
         $list = Db::table('设备_产量计酬')->where($where)->field($field)->select();
+        halt($list);
         $totalA = Db::table('设备_产量计酬')->where($where)->where('sczl_bzdh','A班')->field('SUM(sczl_cl) as 产量')->select();
         $totalB = Db::table('设备_产量计酬')->where($where)->where('sczl_bzdh','B班')->field('SUM(sczl_cl) as 产量')->select();
         if (empty($list)){
@@ -143,13 +144,13 @@ class Facility extends Api
         if (empty($machine) || empty($date)){
             $this->error('参数错误');
         }
-        $last_id = Db::table('制程检验_记录')->order('UniqId desc')->field('UniqId')->find();
-        $startId = $last_id['UniqId']-1000000;
+//        $last_id = Db::table('制程检验_记录')->order('UniqId desc')->field('UniqId')->find();
+//        $startId = $last_id['UniqId']-1000000;
         $where = [
             '设备编号' => $machine,
             '开工时间' => ['between',[date('Y-m-d 08:00:00',strtotime($date)),date('Y-m-d 08:00:00',strtotime($date)+86400)]],
             '类别' => ['in',['IPQC检验','机台检验']],
-            'UniqId' => ['>',$startId],
+//            'UniqId' => ['>',$startId],
         ];
         $begin = Db::table('制程检验_记录')->where($where)->field('UniqId')->find();
         $end = Db::table('制程检验_记录')->where($where)->order('UniqId desc')->field('UniqId')->find();
@@ -231,9 +232,11 @@ class Facility extends Api
         if (empty($machine)){
             $this->error('参数错误');
         }
-        $lastUniqid = Db::table('设备_产量计酬')->field('UniqId')->order('UniqId desc')->find();
-        $startUniqid = $lastUniqid['UniqId']-10000;
-        $workOrder = Db::table('设备_产量计酬')->where('sczl_jtbh',$machine)->where('UniqId','>',$startUniqid)->field('sczl_gdbh')->order('UniqId desc')->find();
+//        $lastUniqid = Db::table('设备_产量计酬')->field('UniqId')->order('UniqId desc')->find();
+//        $startUniqid = $lastUniqid['UniqId']-10000;
+//        halt($lastUniqid);
+        $workOrder = Db::table('设备_产量计酬')->where('sczl_jtbh',$machine)->field('sczl_gdbh')->order('UniqId desc')->find();
+
         if (empty($workOrder)){
             $this->error('未找到正在生产工单');
         }
@@ -250,7 +253,7 @@ class Facility extends Api
             'sczl_gdbh'=>$list['Gy0_gdbh']
         ];
         $facilityField = 'sczl_bh1,sczl_bh2,sczl_bh3,sczl_bh4,sczl_bh5,sczl_bh6,sczl_bh7,sczl_bh8,sczl_bh9,sczl_bh10';
-        $Ctaff = Db::table('设备_产量计酬')->where($facilityWhere)->where('UniqId','>',$startUniqid)->field($facilityField)->order('UniqId desc')->find();
+        $Ctaff = Db::table('设备_产量计酬')->where($facilityWhere)->field($facilityField)->order('UniqId desc')->find();
         $data = [];
         foreach ($Ctaff as $key=>$value){
             if (!empty($value)){
@@ -295,12 +298,12 @@ class Facility extends Api
         }
         $lastTechonUniqId = Db::table('工单_工艺资料')->field('UniqId')->order('UniqId desc')->find();
         $startTechonUniqId = $lastTechonUniqId['UniqId']-10000;
-        $lastYieldUniqId = Db::table('设备_产量计酬')->field('UniqId')->order('UniqId desc')->find();
-        $startYieldUniqId = $lastYieldUniqId['UniqId']-100000;
+//        $lastYieldUniqId = Db::table('设备_产量计酬')->field('UniqId')->order('UniqId desc')->find();
+//        $startYieldUniqId = $lastYieldUniqId['UniqId']-100000;
         $workOrder = Db::table('设备_产量计酬')->where('sczl_jtbh',$machine)->field('sczl_gdbh')->where('UniqId','>',$startYieldUniqId)->order('UniqId desc')->find();
         $startTime = Db::table('工单_工艺资料')->where('Gy0_gdbh',$workOrder['sczl_gdbh'])->where('Gy0_sbbh',$machine)->where('UniqId','>',$startTechonUniqId)->field('Gy0_sj1')->order('UniqId desc')->find();
         $where = [
-            'UniqId' => ['>',$startTechonUniqId],
+//            'UniqId' => ['>',$startTechonUniqId],
             'Gy0_sbbh' => $machine,
             'Gy0_sj1' => ['>= time',$startTime['Gy0_sj1']],
         ];
@@ -328,7 +331,7 @@ class Facility extends Api
             $finished = Db::table('设备_产量计酬')
                 ->where('sczl_gdbh',$value['gdbh'])
                 ->where('sczl_jtbh',$machine)
-                ->where('UniqId','>',$startYieldUniqId)
+//                ->where('UniqId','>',$startYieldUniqId)
                 ->order('UniqId desc')
                 ->field('SUM(sczl_cl) as cl')
                 ->select();
@@ -361,14 +364,17 @@ class Facility extends Api
         if (empty($workOrder)){
             $this->error('参数错误');
         }
-        $lastUniqid = Db::table('设备_产量计酬')->field('UniqId')->order('UniqId desc')->find();
-        $startUniqid = $lastUniqid['UniqId']-100000;
+//        $lastUniqid = Db::table('设备_产量计酬')->field('UniqId')->order('UniqId desc')->find();
+//        $startUniqid = $lastUniqid['UniqId']-100000;
         //右边工艺及完成数量
-        $Process = Db::table('设备_产量计酬')->where('sczl_gdbh',$workOrder)->where('UniqId','>',$startUniqid)->distinct(true)->order('sczl_gxh')->column('sczl_gxh');
+        $Process = Db::table('设备_产量计酬')->where('sczl_gdbh',$workOrder)
+//            ->where('UniqId','>',$startUniqid)
+            ->distinct(true)->order('sczl_gxh')
+            ->column('sczl_gxh');
         $data = [];
         foreach ($Process as $k=>$v){
             $res= Db::table('设备_产量计酬')->where('sczl_gdbh',$workOrder)
-                ->where('UniqId','>',$startUniqid)
+//                ->where('UniqId','>',$startUniqid)
                 ->where('sczl_gxh',$v)
                 ->field('rtrim(sczl_yjno) as sczl_yjno,rtrim(sczl_gxmc) as sczl_gxmc')
                 ->find();
@@ -376,7 +382,11 @@ class Facility extends Api
                 $res['sczl_yjno'] = '0'.$res['sczl_yjno'];
             }
             $processList['process'] = $res['sczl_yjno'].'-'.$res['sczl_gxmc'];
-            $processList['completed'] = Db::table('设备_产量计酬')->where('sczl_gdbh',$workOrder)->where('UniqId','>',$startUniqid)->where('sczl_gxh',$v)->count();
+            $processList['completed'] = Db::table('设备_产量计酬')
+                ->where('sczl_gdbh',$workOrder)
+//                ->where('UniqId','>',$startUniqid)
+                ->where('sczl_gxh',$v)
+                ->count();
             array_push($data,$processList);
         }
         $this->success('成功',$data);
@@ -458,11 +468,11 @@ class Facility extends Api
         if (empty($machine) || empty($workOrder) || empty($team)){
             $this->error('参数错误');
         }
-        $lastUniqid = Db::table('设备_产量计酬')->field('UniqId')->order('UniqId desc')->find();
-        $startUniqid = $lastUniqid['UniqId']-100000;
+//        $lastUniqid = Db::table('设备_产量计酬')->field('UniqId')->order('UniqId desc')->find();
+//        $startUniqid = $lastUniqid['UniqId']-100000;
         $name = Db::table('工单_基本资料')->where('Gd_gdbh',$workOrder)->field('rtrim(Gd_cpmc) as productName')->find();
         $where = [
-            'UniqId' => ['>',$startUniqid],
+//            'UniqId' => ['>',$startUniqid],
             'sczl_gdbh' => $workOrder,
             'sczl_jtbh' => $machine,
             'sczl_cl' => ['<>',0.0],
@@ -518,14 +528,14 @@ class Facility extends Api
         if (empty($machine) || empty($workOrder) || empty($team)){
             $this->error('参数错误');
         }
-        $last_id = Db::table('制程检验_记录')->order('UniqId desc')->field('UniqId')->find();
-        $startId = $last_id['UniqId']-100000;
+//        $last_id = Db::table('制程检验_记录')->order('UniqId desc')->field('UniqId')->find();
+//        $startId = $last_id['UniqId']-100000;
         $where = [
             '设备编号' => $machine,
             '工单编号' => $workOrder,
             '班组编号' => $team,
             '类别' => ['in',['IPQC检验','机台检验']],
-            'UniqId' => ['>',$startId],
+//            'UniqId' => ['>',$startId],
         ];
         //检验项目筛选
         $item = Db::table('制程检验_记录')->where($where)->distinct(true)->column('rtrim(检验项目)');
@@ -659,8 +669,8 @@ class Facility extends Api
         if (empty($param)){
             $this->error('参数错误');
         }
-        $last_id = Db::table('制程检验_记录')->order('UniqId desc')->field('UniqId')->find();
-        $startId = $last_id['UniqId']-100000;
+//        $last_id = Db::table('制程检验_记录')->order('UniqId desc')->field('UniqId')->find();
+//        $startId = $last_id['UniqId']-100000;
         $date = date('Y-m-d H:i:s',time());
         $startTime = date('Y-m-d 08:30:00',time());
         if ($date<$startTime){
@@ -676,7 +686,7 @@ class Facility extends Api
         rtrim(设备编号) as 设备编号,rtrim(班组编号) as 班组编号,rtrim(检验项目) as 现场管理人员,rtrim(检验备注) as 检验备注,
         rtrim(提交时间) as 提交时间,rtrim(开工时间) as 开工时间';
         $list = Db::table('制程检验_记录')->where($where)
-            ->where('UniqId','>',$startId)
+//            ->where('UniqId','>',$startId)
             ->field($filed)
 //            ->fetchSql(true)
             ->select();

+ 3 - 1
application/api/controller/WorkOrder.php

@@ -86,6 +86,8 @@ class WorkOrder extends Api
         }
         if (!empty($workOrder)){
             $where['Gd_gdbh'] = $workOrder;
+        }else{
+            $this->error();
         }
         if (!empty($productCode)){
             $where['Gd_cpdh'] = $productCode;
@@ -259,7 +261,7 @@ class WorkOrder extends Api
                     '开数' => rtrim($value['Gy0_ks']),
                     '联数' => rtrim($value['Gy0_ls']),
                     'UniqId' => rtrim($value['UniqId']),
-                    'shbh' => rtrim($value['Gy0_shbh']),
+                    'shdh' => rtrim($value['Gy0_shdh']),
                     '辅助工时' => rtrim($value['Gy0_辅助工时']),
                     '小时产能' => rtrim($value['Gy0_小时产能'])
                 ];