unknown 3 месяцев назад
Родитель
Сommit
5baa13c1a9

+ 0 - 1
application/api/controller/GlluSalaryCalculation.php

@@ -1 +0,0 @@
-<?php

+ 33 - 0
application/api/controller/GluSalaryCalculation.php

@@ -0,0 +1,33 @@
+<?php
+
+namespace app\api\controller;
+
+use app\common\controller\Api;
+
+class GlluSalaryCalculation extends Api
+{
+    protected $noNeedLogin = ['*'];
+    protected $noNeedRight = ['*'];
+
+
+    public function salaryCalculation()
+    {
+        if(!$this->request->isGet()){
+            $this->error('请求错误');
+        }
+        $params = $this->request->param();
+        if (!isset($params['month']) || empty($params['month'])) {
+            $this->error('参数错误');
+        }
+        //糊盒计件产量
+        $filds = "a.sczl_gdbh as 工单编号,a.sczl_yjno as 印件号,a.sczl_gxh as 工序号,a.sczl_gxmc as 工序名称,a.sczl_cl as 产量,a.sczl_rq as 日期,
+        a.sczl_ls as 联数,a.sczl_dedh as 定额代号,a.工价系数,a.保养工时,a.装版工时,a.异常工时,设备运行工时,a.role,a.sczl_jtbh,b.yj_cpdh,b.yj_yjmc"
+        $list = db('设备_糊盒报工资料')
+            ->alias('a')
+            ->join('工单_印件资料 b', 'a.sczl_gdbh = b.Yj_Gdbh and a.sczl_yjno = b.yj_Yjno')
+            ->field($filds)
+            ->where(['month' => $params['month']])
+            ->select();
+        halt($list);
+    }
+}

+ 9 - 4
application/api/controller/OrderSuperLoss.php

@@ -1298,17 +1298,21 @@ class OrderSuperLoss extends Api
             })
             ->field($field)
             ->find();
+
         if ($data['投料'] == null){
             return false;
         }
         if (!empty($data['yj_tlgg'])){
             $number1 = (int)substr($data['yj_tlgg'],0,3);
             $number2 = (int)substr($data['yj_tlgg'],4,3);
-            preg_match('/(\d+)g/',$data['yj_zzmc'], $matches);
-            if ($data['st_dw'] === '吨'){
-                $data['投料'] = round(($data['投料']*1000*1000)/$matches[1]/($number1*$number2)*1000000);
-                $data['st_dw'] === '张';
+            if ($number1 !== 0 && $number2 !== 0) {
+                preg_match('/(\d+)g/',$data['yj_zzmc'], $matches);
+                if ($data['st_dw'] === '吨'){
+                    $data['投料'] = round(($data['投料']*1000*1000)/$matches[1]/($number1*$number2)*1000000);
+                    $data['st_dw'] === '张';
+                }
             }
+
         }
 
         //将开数、联数为0重新赋值
@@ -1318,6 +1322,7 @@ class OrderSuperLoss extends Api
         if ($data['ks'] == 0) {
             $data['ks'] === 1;
         }
+
         //计算工单实际投料
         $data['实际投料'] = str_replace(',', '', number_format($data['投料'] * $data['ls'] * $data['ks'] / 10000, 4));
         new WorkOrder();