Przeglądaj źródła

up 上传限制

liugc 1 rok temu
rodzic
commit
fd7999b4e9

+ 1 - 1
app/adminapi/lists/master_worker/EngineerSettlementLists.php

@@ -56,7 +56,7 @@ class EngineerSettlementLists extends BaseAdminDataLists implements ListsSearchI
     public function lists(): array
     {
         return EngineerSettlement::where('is_export',2)->where($this->searchWhere)
-            ->field(['id', 'master_worker_id', 'worker_number', 'engineer_name', 'original_balance', 'total_settlement_amount', 'deduction_amount', 'final_settlement_amount', 'settlement_time', 'settlement_details_remarks','batch_number'])
+            ->field(['id', 'master_worker_id', 'worker_number', 'engineer_name', 'original_balance', 'total_settlement_amount', 'deduction_amount','deduction_describe', 'final_settlement_amount', 'settlement_time', 'settlement_details_remarks','batch_number'])
             ->limit($this->limitOffset, $this->limitLength)
             ->order(['id' => 'desc'])
             ->select()

+ 1 - 1
app/adminapi/logic/financial/FinancialPaymentRecordsLogic.php

@@ -105,7 +105,7 @@ class FinancialPaymentRecordsLogic extends BaseLogic
                 }
                 MasterSettlementDetails::where('batch_number',$recordInfo['batch_number'])->where('status','<',3)->update(['status'=>1,'batch_number'=>'']);
                 EngineerSettlement::destroy(['batch_number'=>$recordInfo['batch_number'],'is_deduction'=>['neq',1]]);
-                FinancialPaymentRecords::update(['payment_status'=>2],['id'=>$params['id']]);
+                FinancialPaymentRecords::update(['upload_status'=>2],['id'=>$params['id']]);
             }else{
                 throw new \Exception('记录不存在');
             }

+ 14 - 8
app/adminapi/logic/master_worker/EngineerSettlementLogic.php

@@ -274,27 +274,33 @@ class EngineerSettlementLogic extends BaseLogic
                 $param['deduction_describe'] = $param['deduction_describe']??'';
                 $param['settlement_details_remarks'] = $param['settlement_details_remarks']??'';
 
-                if(!isset($param['final_settlement_amount']) || empty($param['final_settlement_amount'])){
-                    throw new \Exception('应付金额不能为空');
+                if(!isset($param['total_settlement_amount']) || $param['total_settlement_amount']<0){
+                    throw new \Exception('应付金额不能为空或负数:'.$param['master_worker_id']);
+                }
+                if(!isset($param['final_settlement_amount']) || $param['final_settlement_amount']<0){
+                    throw new \Exception('实付金额不能为空或负数:'.$param['master_worker_id']);
+                }
+                if(isset($param['deduction_amount']) && $param['deduction_amount']<0){
+                    throw new \Exception('扣款金额不能为负数:'.$param['master_worker_id']);
                 }
                 if($param['deduction_amount'] > 0 && (!isset($param['deduction_describe']) || empty($param['deduction_describe']))){
-                    throw new \Exception('扣款存在,扣款说明不能为空');
+                    throw new \Exception('扣款存在,扣款说明不能为空:'.$param['master_worker_id']);
                 }
-                if(!in_array($param['master_worker_id'], $engineer_worker_ids)) throw new \Exception('下载记录不存在');
+                if(!in_array($param['master_worker_id'], $engineer_worker_ids)) throw new \Exception('下载记录不存在:'.$param['master_worker_id']);
                 //判断日期时间格式是否正确 2024/1/1 00:00:00 或 2024-1-1 00:00:00
                 if(isset($param['settlement_time']) && !preg_match('/^[0-9]{4}\/[0-9]{1,2}\/[0-9]{1,2} [0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}$/', $param['settlement_time'])
                     && !preg_match('/^[0-9]{4}-[0-9]{1,2}-[0-9]{1,2} [0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}$/', $param['settlement_time'])){
-                    throw new \Exception('日期时间格式错误');
+                    throw new \Exception('日期时间格式错误:'.$param['master_worker_id']);
                 }
                 $param['settlement_time'] = isset($param['settlement_time'])?date('Y-m-d H:i:s', strtotime($param['settlement_time'])):date('Y-m-d H:i:s');
                 if(!is_numeric($param['original_balance']) || !is_numeric($param['total_settlement_amount']) || !is_numeric($param['deduction_amount']) || !is_numeric($param['final_settlement_amount'])){
-                    throw new \Exception('金额格式错误');
+                    throw new \Exception('金额格式错误:'.$param['master_worker_id']);
                 }
-                if($param['total_settlement_amount'] != ($param['final_settlement_amount']+$param['deduction_amount'])){
+                if(abs($param['total_settlement_amount']) != (abs($param['final_settlement_amount'])+abs($param['deduction_amount']))){
                     throw new \Exception('金额计算错误:'.$param['master_worker_id']);
                 }
                 if(!preg_match('/^[0-9]*$/', $param['worker_number'])){
-                    throw new \Exception('工程师编号格式错误:'.$param['worker_number']);
+                    throw new \Exception('工程师编号格式错误:'.$param['master_worker_id']);
                 }
                 if(!preg_match('/^[0-9]*$/', $param['master_worker_id'])){
                     throw new \Exception('工程师ID格式错误:'.$param['master_worker_id']);