新增标书审查模块

This commit is contained in:
yaooo 2023-12-11 16:06:08 +08:00
parent 6da7a10f71
commit 5fe1b9e5c2
4 changed files with 93 additions and 46 deletions

View File

@ -42,29 +42,36 @@ class BidDocumentExaminationLogic extends BaseLogic
Db::startTrans();
try {
$bidDocumentExamination = BidDocumentExamination::create([
'approve_id' => $params['approve_id'],
'buy_bidding_document_id' => $params['buy_bidding_document_id'],
'is_need_deposit' => $params['is_need_deposit'],
'approve_id' => $params['approve_id'] ?? 0,
'buy_bidding_document_id' => $params['buy_bidding_document_id'] ?? 0,
'is_need_deposit' => $params['is_need_deposit'] ?? 0,
'bid_opening_date' => strtotime($params['bid_opening_date']),
'deposit_refund_time' => strtotime($params['deposit_refund_time']),
'bidding_project_overview' => $params['bidding_project_overview'],
'project_introduction' => $params['project_introduction'],
'annex' => $params['annex'],
'technical_protocol_deviation' => $params['technical_protocol_deviation'],
'protocol_deviation_handling_plan' => $params['protocol_deviation_handling_plan'],
'technical_review_annex' => $params['technical_review_annex'],
'business_review_total_amount' => $params['business_review_total_amount'],
'tax_rate' => $params['tax_rate'],
'pay_type' => $params['pay_type'],
'pay_rate' => $params['pay_rate'],
'business_contract_deviation' => $params['business_contract_deviation'],
'business_contract_deviation_handling_plan' => $params['business_contract_deviation_handling_plan'],
'business_contract_deviation_annex' => $params['business_contract_deviation_annex']
'bidding_project_overview' => $params['bidding_project_overview'] ?? '',
'project_introduction' => $params['project_introduction'] ?? '',
'annex' => $params['annex'] ?? '',
'technical_protocol_deviation' => $params['technical_protocol_deviation'] ?? '',
'protocol_deviation_handling_plan' => $params['protocol_deviation_handling_plan'] ?? '',
'technical_review_annex' => $params['technical_review_annex'] ?? '',
'business_review_total_amount' => $params['business_review_total_amount'] ?? 0,
'tax_rate' => $params['tax_rate'] ?? 0,
'pay_type' => $params['pay_type'] ?? 0,
'pay_rate' => $params['pay_rate'] ?? '',
'business_contract_deviation' => $params['business_contract_deviation'] ?? '',
'business_contract_deviation_handling_plan' => $params['business_contract_deviation_handling_plan'] ?? '',
'business_contract_deviation_annex' => $params['business_contract_deviation_annex'] ?? '',
]);
foreach ($params['product'] as $item)
foreach ($params['product'] ?? [] as $item)
{
BidDocumentExaminationDetail::create([
'bid_document_examination_id' => $bidDocumentExamination->id,
'product_id' => $item['product_id'] ?? 0,
'product_num' => $item['product_num'] ?? 0,
'cost_unit_price' => $item['cost_unit_price'] ?? 0,
'amount' => $item['amount'] ?? '',
'rate' => $item['rate'] ?? '',
'unit_price' => $item['unit_price'] ?? 0,
'total_amount' => $item['total_amount'] ?? 0
]);
}
Db::commit();
@ -89,26 +96,39 @@ class BidDocumentExaminationLogic extends BaseLogic
Db::startTrans();
try {
BidDocumentExamination::where('id', $params['id'])->update([
'approve_id' => $params['approve_id'],
'buy_bidding_document_id' => $params['buy_bidding_document_id'],
'is_need_deposit' => $params['is_need_deposit'],
'approve_id' => $params['approve_id'] ?? 0,
'buy_bidding_document_id' => $params['buy_bidding_document_id'] ?? 0,
'is_need_deposit' => $params['is_need_deposit'] ?? 0,
'bid_opening_date' => strtotime($params['bid_opening_date']),
'deposit_refund_time' => strtotime($params['deposit_refund_time']),
'bidding_project_overview' => $params['bidding_project_overview'],
'project_introduction' => $params['project_introduction'],
'annex' => $params['annex'],
'technical_protocol_deviation' => $params['technical_protocol_deviation'],
'protocol_deviation_handling_plan' => $params['protocol_deviation_handling_plan'],
'technical_review_annex' => $params['technical_review_annex'],
'business_review_total_amount' => $params['business_review_total_amount'],
'tax_rate' => $params['tax_rate'],
'pay_type' => $params['pay_type'],
'pay_rate' => $params['pay_rate'],
'business_contract_deviation' => $params['business_contract_deviation'],
'business_contract_deviation_handling_plan' => $params['business_contract_deviation_handling_plan'],
'business_contract_deviation_annex' => $params['business_contract_deviation_annex']
'bidding_project_overview' => $params['bidding_project_overview'] ?? '',
'project_introduction' => $params['project_introduction'] ?? '',
'annex' => $params['annex'] ?? '',
'technical_protocol_deviation' => $params['technical_protocol_deviation'] ?? '',
'protocol_deviation_handling_plan' => $params['protocol_deviation_handling_plan'] ?? '',
'technical_review_annex' => $params['technical_review_annex'] ?? '',
'business_review_total_amount' => $params['business_review_total_amount'] ?? 0,
'tax_rate' => $params['tax_rate'] ?? 0,
'pay_type' => $params['pay_type'] ?? 0,
'pay_rate' => $params['pay_rate'] ?? '',
'business_contract_deviation' => $params['business_contract_deviation'] ?? '',
'business_contract_deviation_handling_plan' => $params['business_contract_deviation_handling_plan'] ?? '',
'business_contract_deviation_annex' => $params['business_contract_deviation_annex'] ?? '',
]);
BidDocumentExaminationDetail::where('bid_document_examination_id', $params['id'])->delete();
foreach ($params['product'] ?? [] as $item)
{
BidDocumentExaminationDetail::create([
'bid_document_examination_id' => $params['id'],
'product_id' => $item['product_id'] ?? 0,
'product_num' => $item['product_num'] ?? 0,
'cost_unit_price' => $item['cost_unit_price'] ?? 0,
'amount' => $item['amount'] ?? '',
'rate' => $item['rate'] ?? '',
'unit_price' => $item['unit_price'] ?? 0,
'total_amount' => $item['total_amount'] ?? 0
]);
}
Db::commit();
return true;
} catch (\Exception $e) {

View File

@ -32,6 +32,7 @@ class BidDocumentExaminationValidate extends BaseValidate
*/
protected $rule = [
'id' => 'require',
'buy_bidding_document_id' => 'require',
'product' => 'array|checkProduct',
];
@ -65,7 +66,7 @@ class BidDocumentExaminationValidate extends BaseValidate
*/
public function sceneEdit()
{
return $this->only(['id', 'product']);
return $this->only(['id', 'buy_bidding_document_id', 'product']);
}
@ -94,16 +95,32 @@ class BidDocumentExaminationValidate extends BaseValidate
public function checkProduct($value, $rule, $data)
{
$firstData = $value[0];
// if (empty($firstData['product_id'])) {
// return '产品ID不能为空';
// }
// if (empty($firstData['product_num'])) {
// return '产品数量不能为空!';
// }
// if (empty($firstData['tax_rate'])) {
// return '产品税率不能为空!';
// }
$firstData = $value[0] ?? [];
if (empty($firstData)) {
return true;
} else {
if (empty($firstData['product_id'])) {
return '产品ID不能为空';
}
if (empty($firstData['product_num'])) {
return '产品数量不能为空!';
}
if (empty($firstData['cost_unit_price'])) {
return '成本单价不能为空!';
}
if (empty($firstData['amount'])) {
return '金额不能为空!';
}
if (empty($firstData['rate'])) {
return '点数不能为空!';
}
if (empty($firstData['unit_price'])) {
return '报价单价不能为空!';
}
if (empty($firstData['total_amount'])) {
return '报价金额不能为空!';
}
}
return true;
}

View File

@ -94,7 +94,7 @@ class QuotationValidate extends BaseValidate
public function checkProduct($value, $rule, $data)
{
$firstData = $value[0];
$firstData = $value[0] ?? [];
if (empty($firstData['product_id'])) {
return '产品ID不能为空';
}

View File

@ -35,4 +35,14 @@ class BidDocumentExamination extends BaseModel
return $this->belongsTo(\app\common\model\bid\BidBuyBiddingDocument::class, 'buy_bidding_document_id');
}
public function getBidOpeningDateAttr($value)
{
return empty($value) ? '' : date('Y-m-d H:i:s', $value);
}
public function getDepositRefundTimeAttr($value)
{
return empty($value) ? '' : date('Y-m-d H:i:s', $value);
}
}