update
This commit is contained in:
parent
adec12360b
commit
e51d9ed831
@ -12,24 +12,24 @@
|
|||||||
// | author: likeadminTeam
|
// | author: likeadminTeam
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
namespace app\adminapi\validate\finance;
|
namespace app\adminapi\validate\finance;
|
||||||
|
|
||||||
|
|
||||||
use app\common\model\contract\ProcurementContract;
|
use app\common\model\contract\ProcurementContract;
|
||||||
use app\common\model\contract\SubcontractingContract;
|
use app\common\model\contract\SubcontractingContract;
|
||||||
use app\common\model\dict\DictData;
|
use app\common\model\dict\DictData;
|
||||||
use app\common\model\finance\FinancePaymentPlan;
|
use app\common\model\finance\FinancePaymentPlan;
|
||||||
use app\common\model\supplier\Supplier;
|
use app\common\model\supplier\Supplier;
|
||||||
use app\common\validate\BaseValidate;
|
use app\common\validate\BaseValidate;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FinancePaymentPlan验证器
|
* FinancePaymentPlan验证器
|
||||||
* Class FinancePaymentPlanValidate
|
* Class FinancePaymentPlanValidate
|
||||||
* @package app\adminapi\validate\finance
|
* @package app\adminapi\validate\finance
|
||||||
*/
|
*/
|
||||||
class FinancePaymentPlanValidate extends BaseValidate
|
class FinancePaymentPlanValidate extends BaseValidate
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置校验规则
|
* 设置校验规则
|
||||||
@ -43,7 +43,6 @@ class FinancePaymentPlanValidate extends BaseValidate
|
|||||||
'period' => 'require|checkPeriod',
|
'period' => 'require|checkPeriod',
|
||||||
'pay_date' => 'require|dateFormat:Y-m-d',
|
'pay_date' => 'require|dateFormat:Y-m-d',
|
||||||
'amount' => 'require|float|gt:0',
|
'amount' => 'require|float|gt:0',
|
||||||
'status' => 'require|checkStatus',
|
|
||||||
'annex' => 'checkAnnex',
|
'annex' => 'checkAnnex',
|
||||||
'flow_id' => 'require|checkFlow',
|
'flow_id' => 'require|checkFlow',
|
||||||
'path' => 'require',
|
'path' => 'require',
|
||||||
@ -74,7 +73,7 @@ class FinancePaymentPlanValidate extends BaseValidate
|
|||||||
*/
|
*/
|
||||||
public function sceneAdd()
|
public function sceneAdd()
|
||||||
{
|
{
|
||||||
return $this->remove('id', true)->remove('flow_id',true)->remove('path',true);
|
return $this->remove('id', true)->remove('flow_id', true)->remove('path', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -86,7 +85,7 @@ class FinancePaymentPlanValidate extends BaseValidate
|
|||||||
*/
|
*/
|
||||||
public function sceneEdit()
|
public function sceneEdit()
|
||||||
{
|
{
|
||||||
return $this->remove('flow_id',true)->remove('path',true);
|
return $this->remove('flow_id', true)->remove('path', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -98,7 +97,7 @@ class FinancePaymentPlanValidate extends BaseValidate
|
|||||||
*/
|
*/
|
||||||
public function sceneDelete()
|
public function sceneDelete()
|
||||||
{
|
{
|
||||||
return $this->only(['id'])->remove('id','checkData');
|
return $this->only(['id'])->remove('id', 'checkData');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -115,13 +114,13 @@ class FinancePaymentPlanValidate extends BaseValidate
|
|||||||
|
|
||||||
public function sceneApprove()
|
public function sceneApprove()
|
||||||
{
|
{
|
||||||
return $this->only(['id','flow_id','path']);
|
return $this->only(['id', 'flow_id', 'path']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkData($value): bool|string
|
public function checkData($value): bool|string
|
||||||
{
|
{
|
||||||
$data = FinancePaymentPlan::where('id',$value)->findOrEmpty();
|
$data = FinancePaymentPlan::where('id', $value)->findOrEmpty();
|
||||||
if($data->isEmpty()){
|
if ($data->isEmpty()) {
|
||||||
return '数据不存在';
|
return '数据不存在';
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -129,26 +128,26 @@ class FinancePaymentPlanValidate extends BaseValidate
|
|||||||
|
|
||||||
public function checkSupplier($value): bool|string
|
public function checkSupplier($value): bool|string
|
||||||
{
|
{
|
||||||
$supplier = Supplier::where('id',$value)->findOrEmpty();
|
$supplier = Supplier::where('id', $value)->findOrEmpty();
|
||||||
if($supplier->isEmpty()){
|
if ($supplier->isEmpty()) {
|
||||||
return '供应商信息不存在';
|
return '供应商信息不存在';
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkContract($value,$rule,$data): bool|string
|
public function checkContract($value, $rule, $data): bool|string
|
||||||
{
|
{
|
||||||
if($data['contract_cate'] == 1){
|
if ($data['contract_cate'] == 1) {
|
||||||
$contract = ProcurementContract::where('id',$value)->findOrEmpty()->toArray();
|
$contract = ProcurementContract::where('id', $value)->findOrEmpty()->toArray();
|
||||||
}elseif($data['contract_cate'] == 2){
|
} elseif ($data['contract_cate'] == 2) {
|
||||||
$contract = SubcontractingContract::where('id',$value)->findOrEmpty()->toArray();
|
$contract = SubcontractingContract::where('id', $value)->findOrEmpty()->toArray();
|
||||||
}else{
|
} else {
|
||||||
$contract = [];
|
$contract = [];
|
||||||
}
|
}
|
||||||
if(empty($contract)){
|
if (empty($contract)) {
|
||||||
return '合同信息不存在';
|
return '合同信息不存在';
|
||||||
}
|
}
|
||||||
if($contract['supplier_id'] != $data['supplier_id']){
|
if ($contract['supplier_id'] != $data['supplier_id']) {
|
||||||
return '合同信息无效';
|
return '合同信息无效';
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -156,20 +155,11 @@ class FinancePaymentPlanValidate extends BaseValidate
|
|||||||
|
|
||||||
public function checkPeriod($value): bool|string
|
public function checkPeriod($value): bool|string
|
||||||
{
|
{
|
||||||
$dict = DictData::where('type_value','pay_period')->column('value');
|
$dict = DictData::where('type_value', 'pay_period')->column('value');
|
||||||
if(!in_array($value,$dict)){
|
if (!in_array($value, $dict)) {
|
||||||
return '期次无效';
|
return '期次无效';
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkStatus($value): bool|string
|
|
||||||
{
|
|
||||||
$dict = DictData::where('type_value','pay_status')->column('value');
|
|
||||||
if(!in_array($value,$dict)){
|
|
||||||
return '状态无效';
|
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user