Browse Source

优化负数相加报错

huangsanjia 1 year ago
parent
commit
2c4cad0117
1 changed files with 14 additions and 12 deletions
  1. 14 12
      application/api/controller/OrderSuperLoss.php

+ 14 - 12
application/api/controller/OrderSuperLoss.php

@@ -123,11 +123,12 @@ class OrderSuperLoss extends Api
         if (empty($pages)){
         if (empty($pages)){
             $pages = 1;
             $pages = 1;
         }
         }
-        $str = '';
-        if (empty($params['search'])){
-            $str = '/'.$date . '/' . $params['code'].'/'.$pages;
-        }
-        $is_have_cache = Cache::get('OrderSuperLoss/getList'.$str);
+//        $str = '';
+//        if (empty($params['search'])){
+//            $str = '/'.$date . '/' . $params['code'].'/'.$pages;
+//        }
+//        $is_have_cache = Cache::get('OrderSuperLoss/getList'.$str);
+        $is_have_cache = false;
         if ($is_have_cache === false){
         if ($is_have_cache === false){
             if (!empty($params['code'])){
             if (!empty($params['code'])){
                 $data = db('成品入仓')->alias('a')
                 $data = db('成品入仓')->alias('a')
@@ -292,11 +293,11 @@ class OrderSuperLoss extends Api
                 'data'=>$data,
                 'data'=>$data,
                 'total' => $total
                 'total' => $total
             ];
             ];
-            if ($str != false){
-                Cache::set('OrderSuperLoss/getList'.$str,$res,3600);
-            }
+//            if ($str != false){
+//                Cache::set('OrderSuperLoss/getList'.$str,$res,3600);
+//            }
         }else{
         }else{
-            $res = Cache::get('OrderSuperLoss/getList'.$str);
+//            $res = Cache::get('OrderSuperLoss/getList'.$str);
         }
         }
         $this->success('请求成功',$res);
         $this->success('请求成功',$res);
     }
     }
@@ -461,7 +462,8 @@ class OrderSuperLoss extends Api
         $total['total_fp'] = 0;
         $total['total_fp'] = 0;
         $total['waste_quality'] = 0;
         $total['waste_quality'] = 0;
         $total['waste_intangible'] = 0;
         $total['waste_intangible'] = 0;
-        $total['reward'] = 0;
+        $total['reward'] = 0; //超节损奖励数组
+        halt($data);
         //按工序打印
         //按工序打印
         if ($params['type'] == 1){
         if ($params['type'] == 1){
             $total['total_waste'] = 0;
             $total['total_waste'] = 0;
@@ -518,7 +520,7 @@ class OrderSuperLoss extends Api
                 $total['waste_intangible'] += $gy_data[$k]['intangible_loss'];
                 $total['waste_intangible'] += $gy_data[$k]['intangible_loss'];
                 $total['total_waste'] += $gy_data[$k]['total_waste'];
                 $total['total_waste'] += $gy_data[$k]['total_waste'];
                 $total['loss'] += $gy_data[$k]['loss'];
                 $total['loss'] += $gy_data[$k]['loss'];
-                $total['reward'] += $gy_data[$k]['工序超节损金额'];
+                $total['reward'] += floatval(str_replace(',', '', $gy_data[$k]['工序超节损金额']));
             }
             }
             $total['reward'] = number_format($total['reward'],2);
             $total['reward'] = number_format($total['reward'],2);
             $data['gy_data'] = $gy_data;
             $data['gy_data'] = $gy_data;
@@ -666,7 +668,7 @@ class OrderSuperLoss extends Api
                 $total['total_fp'] += $item['sczl_zcfp'];
                 $total['total_fp'] += $item['sczl_zcfp'];
                 $total['waste_quality'] += $item['质检废'];
                 $total['waste_quality'] += $item['质检废'];
                 $total['waste_intangible'] += $item['无形损分摊'];
                 $total['waste_intangible'] += $item['无形损分摊'];
-                $total['reward'] += $gy_data[$i]['节损奖'];
+                $total['reward'] += floatval(str_replace(',', '', $gy_data[$i]['节损奖']));
                 $i++;
                 $i++;
             }
             }
             $total['reward'] = number_format($total['reward'],2);
             $total['reward'] = number_format($total['reward'],2);