brook 3 jaren geleden
bovenliggende
commit
9b53533724

+ 2 - 1
common/helpers/bonus/Calc/BaseBusiness.php

@@ -31,6 +31,7 @@ class BaseBusiness
             $this->_calcYear = $periodObj->getYear($periodNum);
             $this->_calcMonth     = $periodObj->getMonth($periodNum);
             $this->_calcYearMonth = $periodObj->getYearMonth($periodNum);
+            $this->_periodId = $periodObj->getPeriodIdByNumber($periodNum);
         } else {
             //todo
             return false;
@@ -77,4 +78,4 @@ class BaseBusiness
         $calcMonth2 = date('Ym', strtotime('+' . ($this->_calcMonth - 2) . ' month', $startTime));
         return [$calcMonth1, $calcMonth2];
     }
-}
+}

+ 8 - 2
common/helpers/bonus/Calc/PullCalcBonusData.php

@@ -34,8 +34,9 @@ class PullCalcBonusData extends BaseBusiness
         'calcBonusQuarter' => ['type' => 'same', 'table' => 'AR_CALC_BONUS_QUARTER'],
         'calcBonusTourism' => ['type' => 'same', 'table' => 'AR_CALC_BONUS_TOURISM'],
 
-        'AR_BS_BONUS_103_CALC_1'        => ['type' => 'same', 'general_clear' => true, 'table' => 'AR_BS_BONUS_103_CALC_1'],
+        'AR_BS_BONUS_103_CALC_1'        => ['type' => 'same', 'general_clear' => true, 'table' => 'AR_BS_BONUS_103_CALC_1', 'condition_type' => 'id', 'condition_field' => 'CALC_PERIOD_ID'],
         'AR_BS_BONUS_103_CALC_EVENT'    => ['type' => 'same', 'general_clear' => true, 'table' => 'AR_BS_BONUS_103_CALC_EVENT'],
+        'AR_BS_BONUS_103_CALC_NET'      => ['type' => 'same', 'general_clear' => true, 'table' => 'AR_BS_BONUS_103_CALC_NET'],
         'AR_BS_BONUS_103_CALC_NET_1'    => ['type' => 'same', 'general_clear' => true, 'table' => 'AR_BS_BONUS_103_CALC_NET_1'],
         'AR_BS_BONUS_103_TEST'          => ['type' => 'same', 'general_clear' => true, 'table' => 'AR_BS_BONUS_103_TEST'],
         'AR_BS_BONUS_103_TEST_NET'      => ['type' => 'same', 'general_clear' => true, 'table' => 'AR_BS_BONUS_103_TEST_NET'],
@@ -289,9 +290,14 @@ class PullCalcBonusData extends BaseBusiness
 //        CalcBonusGX::pageDeleteAll('PERIOD_NUM=' . $this->_periodNum);
 //        CalcBonusGL::pageDeleteAll('PERIOD_NUM=' . $this->_periodNum);
 
+
         foreach (self::BASE_INFO_METHODS as $info) {
             if ('same' == $info['same'] && isset($info['general_clear']) && $info['general_clear']) {
-                $res = self::pageDeleteAll($info['table'], 'PERIOD_NUM=' . $this->_periodNum);
+                if (isset($info['condition_type']) && $info['condition_type'] == 'id') {
+                    $res = self::pageDeleteAll($info['table'], $info['condition_field'] . '=' . $this->_periodId);
+                } else {
+                    $res = self::pageDeleteAll($info['table'], 'PERIOD_NUM=' . $this->_periodNum);
+                }
                 if (!$res) {
                     CalcRecord::record($this->_periodNum, '第' . $this->_periodNum . '期的' . $info['table'] . '表清理失败');
                 }

+ 15 - 0
common/models/Period.php

@@ -892,4 +892,19 @@ class Period extends \common\components\ActiveRecord
 
         return false;
     }
+
+    /**
+     * 是否是结算月节点
+     * @param $periodNum
+     * @return mixed
+     * @throws Exception
+     */
+    public function getPeriodIdByNumber($periodNum = null){
+        $period = $this->setPeriodNum($periodNum);
+        if($period){
+            return $period['ID'];
+        } else {
+            throw new Exception('id对应的期数不存在');
+        }
+    }
 }