liuhairui hai 11 meses
pai
achega
0acc53245c

+ 4 - 2
application/api/controller/Facility.php

@@ -1322,7 +1322,7 @@ class Facility extends Api
         $machineDetail = \db('设备_产量采集')
             ->alias('a')
             ->join('设备_基本资料 b','a.设备编号 = b.设备编号')
-            ->join('工单_工艺资料 c','a.工单编号 = c.Gy0_gdbh AND a.设备编号 = c.Gy0_sbbh')
+            ->join('工单_工艺资料 c', "a.工单编号 = c.Gy0_gdbh AND c.Gy0_sbbh LIKE CONCAT('%', a.设备编号, '%')")
             ->join('工单_基本资料 d','a.工单编号 = d.Gd_gdbh')
             ->field([
                 'rtrim(a.开工时间)' => '开工时间',
@@ -1336,6 +1336,8 @@ class Facility extends Api
             ->where('a.设备编号', $param['machine'])
             ->order('a.UniqId desc')
             ->find();
+
+
         $data['machine'] = [
             '日期' => $machineDetail['开工时间'],
             '设备' => $machineDetail['设备编号'].'-->'.$machineDetail['设备名称'],
@@ -2651,4 +2653,4 @@ class Facility extends Api
             $this->error('未找到数据');
         }
     }
-}
+}

+ 9 - 19
application/api/controller/LargeWasteRewardPunish.php

@@ -554,21 +554,17 @@ class LargeWasteRewardPunish extends Api
      */
     public function JunkDetailAdd()
     {
-        // 非POST请求不允许提交
         if (Request::instance()->isPost() === false) {
             $this->error('非法请求');
         }
-
         $param = Request::instance()->post();
 
-        // 检查是否传入必要的参数
         if (empty($param['sczl_gdbh'])) {
             $this->error('参数错误');
         }
 
         // 获取最后一条记录的UniqId
         $lastID = \db('db_大废品')->order('UniqId desc')->value('UniqId');
-
         // 设置当前时间和其他初始化数据
         $param['sys_rq'] = date('Y-m-d H:i:s', time());
         $param['mod_rq'] = '1900-01-01 00:00:00';
@@ -576,17 +572,16 @@ class LargeWasteRewardPunish extends Api
 
         $data = $param['sczl_rq'];
 
-
         //奖励班组封顶限制【记录是否存在超限的标志】
         $over_limit = false;
         // 遍历参数,检查每个人当天和本月的消费情况
         for ($i = 1; $i <= 10; $i++) {
-            $jl_bh = 'JL_bh' . $i;  // 获取 JL_bh1 到 JL_bh10
-            $jl_je = 'JL_Je' . $i;  // 获取 JL_Je1 到 JL_Je10
+            $jl_bh = 'JL_bh' . $i;
+            $jl_je = 'JL_Je' . $i;
 
-            if (!empty($param[$jl_bh]) && isset($param[$jl_je])) {  // 确保 JL_bh 和 JL_Je 不为空
-                $person_id = $param[$jl_bh];  // 获取当前人的 ID
-                $amount = $param[$jl_je];     // 当前人的金额
+            if (!empty($param[$jl_bh]) && isset($param[$jl_je])) {
+                $person_id = $param[$jl_bh];
+                $amount = $param[$jl_je];
 
                 // 获取当天的所有记录金额总和
                 $daily_total = \db('db_大废品')
@@ -606,21 +601,20 @@ class LargeWasteRewardPunish extends Api
 
 
                 // 检查当天是否超过 200
-                if ($daily_total + $amount > 200) {
+                if ($daily_total + ($amount * $param['sczl_cl']) > 200) {
                     $this->error("【{$person_id}】当天金额超限!当天金额不能超过200元!");
                     $over_limit = true;
                     break;
                 }
 
                 // 检查本月是否超过 1500
-                if ($monthly_total + $amount > 1500) {
+                if ($monthly_total + ($amount * $param['sczl_cl']) > 1500) {
                     $this->error("【{$person_id}】本月金额超限!本月金额不能超过1500元!");
                     $over_limit = true;
                     break;
                 }
             }
         }
-
         // 如果超限就不插入数据
         if ($over_limit) {
             // 提示超限后停止执行
@@ -630,7 +624,6 @@ class LargeWasteRewardPunish extends Api
 
         // 记录是否存在超限
         $kfover_limit = false;
-
         // 获取 sczl_bh1 的值,并检查它是否存在
         if (!empty($param['sczl_bh1']) && isset($param['sczl_je1'])) {
             $person_id = $param['sczl_bh1'];
@@ -643,7 +636,7 @@ class LargeWasteRewardPunish extends Api
                 ->sum('sczl_je1');
 
             // 判断是否超过 1000
-            if ($daily_total + $amount > 1000) {
+            if ($daily_total + ($amount * $param['sczl_cl']) > 1000) {
                 $this->error("【{$person_id}】当天扣罚金额超限!当天扣罚金额不能超过 1000 元!");
                 $kfover_limit = true;
             }
@@ -664,21 +657,18 @@ class LargeWasteRewardPunish extends Api
                     ->sum($sczl_je);
 
                 // 判断是否超过 500
-                if ($daily_total + $amount > 500) {
+                if ($daily_total + ($amount * $param['sczl_cl']) > 500) {
                     $this->error("【{$person_id}】当天扣罚金额超限!当天扣罚金额不能超过 500 元!");
                     $kfover_limit = true;
                     break; // 只要有一个超限就停止检查
                 }
             }
         }
-
         // 如果超限就不插入数据
         if ($kfover_limit) {
             return; // 直接终止
         }
 
-
-
         // 插入数据
         $sql = \db('db_大废品')->fetchSql(true)->insert($param);
         $res = \db()->query($sql);