소스 검색

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

曹鹤洋 1 년 전
부모
커밋
0b3d39b9a5
2개의 변경된 파일9개의 추가작업 그리고 11개의 파일을 삭제
  1. 5 11
      application/api/controller/Facility.php
  2. 4 0
      application/api/controller/ReportingWork.php

+ 5 - 11
application/api/controller/Facility.php

@@ -100,8 +100,8 @@ class Facility extends Api
         $machineDetail = \db('设备_基本资料')->where('设备编号',$machine)->field('rtrim(千件工价) as 千件工价,rtrim(日定额) as 日定额')->find();
         //组员信息
         $list = \db('设备_产量计酬')->where($where)->field($field)->select();
-        $totalA = \db('设备_产量计酬')->where($where)->where('sczl_bzdh','A班')->field('SUM(sczl_cl) as 产量')->select();
-        $totalB = \db('设备_产量计酬')->where($where)->where('sczl_bzdh','B班')->field('SUM(sczl_cl) as 产量')->select();
+        $totalA = \db('设备_产量计酬')->where($where)->where('sczl_bzdh','like','A%')->field('SUM(sczl_cl) as 产量')->select();
+        $totalB = \db('设备_产量计酬')->where($where)->where('sczl_bzdh','like','B%')->field('SUM(sczl_cl) as 产量')->select();
         if (empty($list)){
             $this->success('',[]);
         }
@@ -500,18 +500,11 @@ class Facility extends Api
         $machine = input('machine');
         $workOrder = input('Gd_gdbh');
         $team = substr(input('team'),0,1);
-        if (empty($machine) || empty($workOrder) || empty($team)){
+        if (empty($machine) || empty($team)){
             $this->success('');
         }
-        $newTime = date('Y-m-d H:i:s',time());
-        if ($newTime < date('Y-m-d 08:30:00')) {
-            $sczlTime = date('Y-m-d 00:00:00', time() - 86400);
-        }else{
-            $sczlTime = date('Y-m-d 00:00:00');
-        }
-        $name = \db('工单_基本资料')->where('Gd_gdbh',$workOrder)->field('rtrim(Gd_cpmc) as productName')->find();
+        $sczlTime = date('Y-m-d 00:00:00',time());
         $where = [
-            'sczl_gdbh' => $workOrder,
             'sczl_jtbh' => $machine,
             'sczl_bzdh' => ['like',$team.'%'],
             'sczl_rq' => $sczlTime,
@@ -526,6 +519,7 @@ class Facility extends Api
             $this->success('');
         }
         foreach ($list as $k=>$v){
+            $name = \db('工单_基本资料')->where('Gd_gdbh',$v['工单编号'])->where('行号',$v['yjno'])->field('rtrim(Gd_cpmc) as productName')->find();
             if ($v['yjno']<10){
                 $list[$k]['yjno'] = '0'.$v['yjno'];
             }

+ 4 - 0
application/api/controller/ReportingWork.php

@@ -342,6 +342,10 @@ class ReportingWork extends Api
             $this->error('非法请求');
         }
         $params = Request::instance()->post();
+        $time = date('Y-m-d 08:30:00',time()-86400);
+        if ($params['sczl_sj2']<date('Y-m-d 08:30:00',time()) && $params['sczl_sj2']>date('Y-m-d 00:00:00')){
+            $params['sczl_rq'] = $time;
+        }
         $machine = $params['sczl_jtbh'].'#';
         $batchData = []; //批次追踪数据
         $batch = $params['bom'];