|
|
@ -58,6 +58,30 @@ class StatementWarningSetController extends Controller {
|
|
|
|
$this->isInit = true;
|
|
|
|
$this->isInit = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function run()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
$count_date = date('Y',time()).'-'.(date('m',time()));
|
|
|
|
|
|
|
|
$this->configInit($count_date);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$hasdb = $this->statementWarningModel->where([
|
|
|
|
|
|
|
|
'count_year'=>$this->year,
|
|
|
|
|
|
|
|
'count_month'=>$this->month,
|
|
|
|
|
|
|
|
"name"=>'wm_platm',
|
|
|
|
|
|
|
|
"type"=>1
|
|
|
|
|
|
|
|
])->find();
|
|
|
|
|
|
|
|
if(!$hasdb){
|
|
|
|
|
|
|
|
//第一次生成,同时上一次结扎
|
|
|
|
|
|
|
|
$year = date("Y",$this->beginThismonth-1);
|
|
|
|
|
|
|
|
$month = date("m",$this->beginThismonth-1);
|
|
|
|
|
|
|
|
$preMonth = $year."-".$month;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$params = "php ".SUBSITE_INDEX." StatementWarningSet/setFreeMonth/count_date/{$preMonth}";
|
|
|
|
|
|
|
|
$time = time()+2*3600;
|
|
|
|
|
|
|
|
D("CmdTasks")->addScheduleTask("StatementWarningSet",$params,$time);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->setStatementWarning();
|
|
|
|
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 更新某月毛利数据
|
|
|
|
* 更新某月毛利数据
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -75,9 +99,9 @@ class StatementWarningSetController extends Controller {
|
|
|
|
$this->getInsideCompanyid();
|
|
|
|
$this->getInsideCompanyid();
|
|
|
|
$this->setCompanyIsWm();
|
|
|
|
$this->setCompanyIsWm();
|
|
|
|
|
|
|
|
|
|
|
|
// $this->getAllWmAmount();
|
|
|
|
$this->getAllWmAmount();
|
|
|
|
// $this->cpStatement();
|
|
|
|
$this->cpStatement();
|
|
|
|
// $this->pcStatement();
|
|
|
|
$this->pcStatement();
|
|
|
|
$this->puStatement();
|
|
|
|
$this->puStatement();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -107,39 +131,46 @@ class StatementWarningSetController extends Controller {
|
|
|
|
$month = date("m",$this->beginThismonth-1);
|
|
|
|
$month = date("m",$this->beginThismonth-1);
|
|
|
|
//cp
|
|
|
|
//cp
|
|
|
|
$preCpMonth = $this->statementWarningInfoModel->where([
|
|
|
|
$preCpMonth = $this->statementWarningInfoModel->where([
|
|
|
|
'year'=>$year,
|
|
|
|
'count_year'=>$year,
|
|
|
|
'month'=>$month,
|
|
|
|
'count_month'=>$month,
|
|
|
|
'company_belong'=>9
|
|
|
|
'company_belong'=>9
|
|
|
|
])->getField('company_id,is_wm',true);
|
|
|
|
])->getField('company_id,is_wm',true);
|
|
|
|
|
|
|
|
|
|
|
|
$selfCpMonth = $this->statementWarningInfoModel->where([
|
|
|
|
$selfCpMonth = $this->statementWarningInfoModel->where([
|
|
|
|
'year'=>$this->year,
|
|
|
|
'count_year'=>$this->year,
|
|
|
|
'month'=>$this->month,
|
|
|
|
'count_month'=>$this->month,
|
|
|
|
'company_belong'=>9
|
|
|
|
'company_belong'=>9
|
|
|
|
])->getField('company_id,is_wm',true);
|
|
|
|
])->getField('company_id,is_wm',true);
|
|
|
|
|
|
|
|
|
|
|
|
if(!$preCpMonth) $preCpMonth = [];
|
|
|
|
if(!$preCpMonth) $preCpMonth = [];
|
|
|
|
if(!$selfCpMonth) $selfCpMonth = [];
|
|
|
|
if(!$selfCpMonth) $selfCpMonth = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->cpCompanyIsWm = array_merge($preCpMonth,$selfCpMonth);
|
|
|
|
$this->cpCompanyIsWm = $preCpMonth;
|
|
|
|
|
|
|
|
foreach ($selfCpMonth as $key => $value) {
|
|
|
|
|
|
|
|
$this->cpCompanyIsWm[$key] = $value;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//下游
|
|
|
|
//下游
|
|
|
|
$preMonth = $this->statementWarningInfoModel->where([
|
|
|
|
$preMonth = $this->statementWarningInfoModel->where([
|
|
|
|
'year'=>$year,
|
|
|
|
'count_year'=>$year,
|
|
|
|
'month'=>$month,
|
|
|
|
'count_month'=>$month,
|
|
|
|
'company_belong'=>['NEQ',9]
|
|
|
|
'company_belong'=>['NEQ',9]
|
|
|
|
])->getField('company_id,is_wm',true);
|
|
|
|
])->getField('company_id,is_wm',true);
|
|
|
|
|
|
|
|
|
|
|
|
$selfMonth = $this->statementWarningInfoModel->where([
|
|
|
|
$selfMonth = $this->statementWarningInfoModel->where([
|
|
|
|
'year'=>$this->year,
|
|
|
|
'count_year'=>$this->year,
|
|
|
|
'month'=>$this->month,
|
|
|
|
'count_month'=>$this->month,
|
|
|
|
'company_belong'=>['NEQ',9]
|
|
|
|
'company_belong'=>['NEQ',9]
|
|
|
|
])->getField('company_id,is_wm',true);
|
|
|
|
])->getField('company_id,is_wm',true);
|
|
|
|
|
|
|
|
|
|
|
|
if(!$preMonth) $preMonth = [];
|
|
|
|
if(!$preMonth) $preMonth = [];
|
|
|
|
if(!$selfMonth) $selfMonth = [];
|
|
|
|
if(!$selfMonth) $selfMonth = [];
|
|
|
|
|
|
|
|
|
|
|
|
$this->promoteCompanyIsWm = array_merge($preMonth,$selfMonth);
|
|
|
|
$this->promoteCompanyIsWm = $preMonth;
|
|
|
|
|
|
|
|
foreach ($selfMonth as $key => $value) {
|
|
|
|
|
|
|
|
$this->promoteCompanyIsWm[$key] = $value;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|