Explorar el Código

决策支持优化

qiuenguang hace 1 año
padre
commit
3dca7ce3b9

+ 18 - 10
application/api/controller/Decision.php

@@ -122,12 +122,19 @@ class Decision extends Api
             $this->error('请求错误');
         }
         $param = $this->request->param();
-        if (empty($param['mouth']) || empty($param['machine']) || empty($param['team'])){
+        if (empty($param['mouth'])){
             $this->error('参数错误');
         }
+        if (isset($param['machine']) && !empty($param['machine'])){
+            $where['a.sczl_jtbh'] = $param['machine'];
+        }
+        if (isset($param['team']) && !empty($param['team'])){
+            $where['a.sczl_bzdh'] = ['like',substr($param['team'],0,1).'%'];
+        }
         //将参数装换成标准日期格式
         $mouth = date_create_from_format('Ym', $param['mouth'])->format('Y-m');
-        $team = substr($param['team'],0,1);
+        $where['a.sczl_rq'] = ['like',$mouth.'%'];
+//        $team = substr($param['team'],0,1);
         $list = \db('设备_产量计酬')
             ->alias('a')
             ->join('工单_印件资料 c','a.sczl_gdbh = c.Yj_Gdbh AND a.sczl_yjno = c.yj_Yjno')
@@ -137,16 +144,14 @@ class Decision extends Api
                 'a.sczl_yjno' => '印件号',
                 'a.sczl_gxh' => '工序号',
                 'c.yj_yjmc' => '印件名称',
-                'd.Gy0_gxmc' => '工序名称',
+                'CONCAT(d.Gy0_gxmc,"(",d.Add_gxmc,")")' => '工序名称',
                 'DATE(a.sczl_rq)' => '工作日期',
                 'a.sczl_jtbh' => '机台编号',
                 'a.sczl_bzdh' => '班组编号',
                 'SUM(a.sczl_cl)' => '产量',
                 'a.sczl_ms' => '墨色数'
             ])
-            ->whereTime('a.sczl_rq',$mouth)
-            ->where('a.sczl_jtbh',$param['machine'])
-            ->where('a.sczl_bzdh','like',$team.'%')
+            ->where($where)
             ->group('a.sczl_gdbh,a.sczl_yjno,a.sczl_gxh')
             ->order('工作日期')
             ->select();
@@ -234,11 +239,15 @@ class Decision extends Api
             $this->error('请求错误');
         }
         $param = $this->request->param();
-        if (empty($param['mouth']) || empty($param['machine'])){
+        if (empty($param['mouth'])){
             $this->error('参数错误');
         }
+        if (isset($param['machine']) && !empty($param['machine'])){
+            $where['a.sczl_jtbh'] = $param['machine'];
+        }
         //将参数装换成标准日期格式
         $mouth = date_create_from_format('Ym', $param['mouth'])->format('Y-m');
+        $where['a.sczl_rq'] = ['like',$mouth.'%'];
         $list = \db('设备_产量计酬')
             ->alias('a')
             ->join('设备_基本资料 b','a.sczl_jtbh = b.设备编号')
@@ -252,7 +261,7 @@ class Decision extends Api
                 'a.sczl_yjno' => '印件号',
                 'a.sczl_gxh' => '工序号',
                 'c.yj_yjmc' => '印件名称',
-                'd.Gy0_gxmc' => '工序名称',
+                'CONCAT(d.Gy0_gxmc,"(",d.Add_gxmc,")")' => '工序名称',
                 'SUM(a.sczl_cl)' => '产量',
                 'SUM(a.sczl_设备运行工时)' => '设备运行工时',
                 'SUM(a.sczl_保养工时)' => '保养工时',
@@ -263,8 +272,7 @@ class Decision extends Api
                 'SUM(a.sczl_异常停机工时)' => '异常停机工时',
                 'a.sczl_ms' => '墨色数'
             ])
-            ->whereTime('a.sczl_rq',$mouth)
-            ->where('a.sczl_jtbh',$param['machine'])
+            ->where($where)
             ->group('a.sczl_rq,a.sczl_gdbh')
             ->order('a.sczl_rq')
             ->select();

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

@@ -243,7 +243,7 @@ class PackagingProcessOutput extends Api
         }else{
             $this->error('参数错误');
         }
-        $gxmc = ['包装'];
+        $gxmc = ['包装','成品防护'];
 
         $gxmcs = [];
         foreach ($gxmc as $k=>$v){

+ 2 - 0
application/api/controller/Synchronization.php

@@ -131,6 +131,7 @@ class Synchronization extends Api
                     }
                 } else {
                     unset($data['Uniqid']);
+                    unset($data['行号']);
                     $updateSql = \db('工单_基本资料')->where('U8UID', $value['U8_UID'])->fetchSql(true)->update($data);
                     $updateRes = \db()->query($updateSql);
                     if ($updateRes === false) {
@@ -1244,6 +1245,7 @@ class Synchronization extends Api
                     $db7->execute($sqlString);
                 }
             } else {
+                unset($data['行号']);
                 $updateSql = \db('工单_基本资料')->where('U8UID', $value['U8_UID'])->fetchSql(true)->update($data);
                 $updateRes = \db()->query($updateSql);
                 if ($updateRes === false) {