update
This commit is contained in:
parent
391d1bbe40
commit
c01031ccbf
app
adminapi
controller/bid
BidBiddingDecisionController.phpBidBuyBiddingDocumentController.phpBidDocumentExaminationController.php
logic/bid
validate/bid
common/model/bid
@ -61,6 +61,26 @@ class BidBiddingDecisionController extends BaseAdminController
|
||||
return $this->fail(BidBiddingDecisionLogic::getError());
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
$params = (new BidBiddingDecisionValidate())->post()->goCheck('edit');
|
||||
$result = BidBiddingDecisionLogic::edit($params);
|
||||
if (true === $result) {
|
||||
return $this->success('编辑成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(BidBiddingDecisionLogic::getError());
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
$params = (new BidBiddingDecisionValidate())->post()->goCheck('delete');
|
||||
$result = BidBiddingDecisionLogic::delete($params);
|
||||
if (true === $result) {
|
||||
return $this->success('删除成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(BidBiddingDecisionLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取投标决策详情
|
||||
|
@ -61,6 +61,26 @@ class BidBuyBiddingDocumentController extends BaseAdminController
|
||||
return $this->fail(BidBuyBiddingDocumentLogic::getError());
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
$params = (new BidBuyBiddingDocumentValidate())->post()->goCheck('edit');
|
||||
$result = BidBuyBiddingDocumentLogic::edit($params);
|
||||
if (true === $result) {
|
||||
return $this->success('编辑成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(BidBuyBiddingDocumentLogic::getError());
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
$params = (new BidBuyBiddingDocumentValidate())->post()->goCheck('delete');
|
||||
$result = BidBuyBiddingDocumentLogic::delete($params);
|
||||
if (true === $result) {
|
||||
return $this->success('删除成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(BidBuyBiddingDocumentLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取购买标书详情
|
||||
|
@ -60,6 +60,26 @@ class BidDocumentExaminationController extends BaseAdminController
|
||||
}
|
||||
return $this->fail(BidDocumentExaminationLogic::getError());
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
$params = (new BidDocumentExaminationValidate())->post()->goCheck('edit');
|
||||
$result = BidDocumentExaminationLogic::edit($params,$this->adminId);
|
||||
if (true === $result) {
|
||||
return $this->success('编辑成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(BidDocumentExaminationLogic::getError());
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
$params = (new BidDocumentExaminationValidate())->post()->goCheck('delete');
|
||||
$result = BidDocumentExaminationLogic::delete($params);
|
||||
if (true === $result) {
|
||||
return $this->success('删除成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(BidDocumentExaminationLogic::getError());
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 获取标书审查详情
|
||||
|
@ -16,6 +16,7 @@ namespace app\adminapi\logic\bid;
|
||||
|
||||
|
||||
use app\common\model\bid\BidBiddingDecision;
|
||||
use app\common\model\bid\BidBuyBiddingDocument;
|
||||
use app\common\model\custom\Custom;
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\oa\FlowApprove;
|
||||
@ -59,7 +60,7 @@ class BidBiddingDecisionLogic extends BaseLogic
|
||||
'project_assurance' => $params['project_assurance'] ?? 0,
|
||||
'bid_project_overview' => $params['bid_project_overview'] ?? '',
|
||||
'project_desc' => $params['project_desc'] ?? '',
|
||||
'annex' => $params['annex']? json_encode($params['annex']) : null,
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
]);
|
||||
Project::where('id',$params['project_id'])->update([
|
||||
'status' => 2,
|
||||
@ -101,7 +102,7 @@ class BidBiddingDecisionLogic extends BaseLogic
|
||||
'project_assurance' => $params['project_assurance'] ?? 0,
|
||||
'bid_project_overview' => $params['bid_project_overview'] ?? '',
|
||||
'project_desc' => $params['project_desc'] ?? '',
|
||||
'annex' => $params['annex']? json_encode($params['annex']) : null,
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
'update_time' => time(),
|
||||
]);
|
||||
Db::commit();
|
||||
@ -123,6 +124,11 @@ class BidBiddingDecisionLogic extends BaseLogic
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
$data = BidBuyBiddingDocument::where('bid_decision_id','in',$params['id'])->findOrEmpty();
|
||||
if(!$data->isEmpty()){
|
||||
self::setError('此数据关联了购买标书信息,需删除购买标书信息');
|
||||
return false;
|
||||
}
|
||||
return BidBiddingDecision::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@ namespace app\adminapi\logic\bid;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\bid\BidBiddingDecision;
|
||||
use app\common\model\bid\BidBuyBiddingDocument;
|
||||
use app\common\model\bid\BidDocumentExamination;
|
||||
use app\common\model\custom\Custom;
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\oa\FlowApprove;
|
||||
@ -105,6 +106,11 @@ class BidBuyBiddingDocumentLogic extends BaseLogic
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
$data = BidDocumentExamination::where('buy_bidding_document_id',$params['id'])->findOrEmpty();
|
||||
if(!$data->isEmpty()){
|
||||
self::setError('此数据关联了标书审查信息,需删除标书审查信息');
|
||||
return false;
|
||||
}
|
||||
return BidBuyBiddingDocument::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@ use app\common\model\bid\BidBuyBiddingDocument;
|
||||
use app\common\model\bid\BidDocumentExamination;
|
||||
use app\common\model\bid\BidDocumentExaminationDetail;
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\bid\BidResult;
|
||||
use app\common\model\custom\Custom;
|
||||
use app\common\model\oa\FlowApprove;
|
||||
use app\common\model\project\Project;
|
||||
@ -47,23 +48,22 @@ class BidDocumentExaminationLogic extends BaseLogic
|
||||
$buy_bidding_document = BidBuyBiddingDocument::field('project_id')->where('id',$params['buy_bidding_document_id'])->findOrEmpty();
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = $bidDocumentExamination = BidDocumentExamination::create([
|
||||
$bidDocumentExamination = BidDocumentExamination::create([
|
||||
'code' => data_unique_code('标书审查'),
|
||||
'project_id' => $buy_bidding_document['project_id'],
|
||||
'buy_bidding_document_id' => $params['buy_bidding_document_id'],
|
||||
'technical_protocol_deviation' => $params['technical_protocol_deviation'] ?? '',
|
||||
'protocol_deviation_handling_plan' => $params['protocol_deviation_handling_plan'] ?? '',
|
||||
'technical_review_annex' => !empty($params['technical_review_annex']) ? $params['technical_review_annex'] : null,
|
||||
'technical_review_annex' => $params['technical_review_annex'] ? json_encode($params['technical_review_annex']) : null,
|
||||
'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' => !empty($params['business_contract_deviation_annex']) ? $params['business_contract_deviation_annex'] : null,
|
||||
'business_contract_deviation_annex' => $params['business_contract_deviation_annex'] ? json_encode($params['business_contract_deviation_annex']) : null,
|
||||
]);
|
||||
if(!empty($params['quotation_detail'])){
|
||||
$quotation_detail = $params['quotation_detail'];
|
||||
foreach ($quotation_detail as $item)
|
||||
foreach ($params['quotation_detail'] as $item)
|
||||
{
|
||||
BidDocumentExaminationDetail::create([
|
||||
'bid_document_examination_id' => $bidDocumentExamination->id,
|
||||
@ -87,6 +87,81 @@ class BidDocumentExaminationLogic extends BaseLogic
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static function edit(array $params,$admin_id): bool
|
||||
{
|
||||
$buy_bidding_document = BidBuyBiddingDocument::field('project_id')->where('id',$params['buy_bidding_document_id'])->findOrEmpty();
|
||||
Db::startTrans();
|
||||
try {
|
||||
BidDocumentExamination::where('id',$params['id'])->update([
|
||||
'project_id' => $buy_bidding_document['project_id'],
|
||||
'buy_bidding_document_id' => $params['buy_bidding_document_id'],
|
||||
'technical_protocol_deviation' => $params['technical_protocol_deviation'] ?? '',
|
||||
'protocol_deviation_handling_plan' => $params['protocol_deviation_handling_plan'] ?? '',
|
||||
'technical_review_annex' => $params['technical_review_annex'] ? json_encode($params['technical_review_annex']) : null,
|
||||
'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'] ? json_encode($params['business_contract_deviation_annex']) : null,
|
||||
'update_time' => time(),
|
||||
]);
|
||||
if(!empty($params['quotation_detail'])){
|
||||
foreach ($params['quotation_detail'] as $item)
|
||||
{
|
||||
if(!empty($item['id'])){
|
||||
BidDocumentExaminationDetail::where('id',$item['id'])->update([
|
||||
'bid_document_examination_id' => $params['id'],
|
||||
'product_id' => $item['product_id'],
|
||||
'num' => $item['num'],
|
||||
'points' => $item['points'] ?? 0,
|
||||
'cost_price' => $item['cost_price'],
|
||||
'sale_price' => $item['sale_price'],
|
||||
'cost_amount' => $item['cost_price'] * $item['num'],
|
||||
'sale_amount' => $item['sale_price'] * $item['num'],
|
||||
'update_user' => $admin_id,
|
||||
'update_time' => time()
|
||||
]);
|
||||
}else{
|
||||
BidDocumentExaminationDetail::create([
|
||||
'bid_document_examination_id' => $params['id'],
|
||||
'product_id' => $item['product_id'],
|
||||
'num' => $item['num'],
|
||||
'points' => $item['points'] ?? 0,
|
||||
'cost_price' => $item['cost_price'],
|
||||
'sale_price' => $item['sale_price'],
|
||||
'cost_amount' => $item['cost_price'] * $item['num'],
|
||||
'sale_amount' => $item['sale_price'] * $item['num'],
|
||||
'add_user' => $admin_id,
|
||||
'update_user' => $admin_id
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
$detail = BidDocumentExaminationDetail::where('bid_document_examination_id',$params['id'])->findOrEmpty();
|
||||
if(!$detail->isEmpty()){
|
||||
self::setError('此数据关联了审查明细信息,需删除审查明细信息');
|
||||
return false;
|
||||
}
|
||||
$result = BidResult::where('bid_document_examination_id',$params['id'])->findOrEmpty();
|
||||
if(!$result->isEmpty()){
|
||||
self::setError('此数据关联了投标结果信息,需删除投标结果信息');
|
||||
return false;
|
||||
}
|
||||
return BidDocumentExamination::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
@ -164,15 +164,5 @@ class BidBiddingDecisionValidate extends BaseValidate
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function checkAnnex($value): bool|string
|
||||
{
|
||||
if(!empty($value) && $value != ''){
|
||||
if(!is_array($value)){
|
||||
return '附件格式错误';
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -17,6 +17,7 @@ namespace app\adminapi\validate\bid;
|
||||
|
||||
use app\common\model\bid\BidBuyBiddingDocument;
|
||||
use app\common\model\bid\BidDocumentExamination;
|
||||
use app\common\model\bid\BidDocumentExaminationDetail;
|
||||
use app\common\model\dict\DictData;
|
||||
use app\common\model\material\Material;
|
||||
use app\common\validate\BaseValidate;
|
||||
@ -122,16 +123,6 @@ class BidDocumentExaminationValidate extends BaseValidate
|
||||
return true;
|
||||
}
|
||||
|
||||
public function checkAnnex($value): bool|string
|
||||
{
|
||||
if(!empty($value) && $value != ''){
|
||||
if(!is_array($value)){
|
||||
return '附件格式错误';
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function checkTaxRate($value): bool|string
|
||||
{
|
||||
$dictDate = DictData::where('type_value','tax_rate')->column('value');
|
||||
@ -150,13 +141,16 @@ class BidDocumentExaminationValidate extends BaseValidate
|
||||
return true;
|
||||
}
|
||||
|
||||
public function checkQuotationDetail($value,$rule,$data): bool|string
|
||||
public function checkQuotationDetail($value): bool|string
|
||||
{
|
||||
$quotation_detail = $value;
|
||||
if(empty($quotation_detail) || !is_array($quotation_detail)){
|
||||
if(empty($value) || !is_array($value)){
|
||||
return '审查明细数据格式错误';
|
||||
}
|
||||
foreach($quotation_detail as $v) {
|
||||
foreach($value as $k=>$v) {
|
||||
if(!empty($v['id'])){
|
||||
$quotation_detail = BidDocumentExaminationDetail::where('id',$v['id'])->findOrEmpty();
|
||||
if($quotation_detail->isEmpty()) return '审查明细列表第'.($k+1).'行审查明细数据不存在';
|
||||
}
|
||||
if(empty($v['product_id'])){
|
||||
return '请选择产品';
|
||||
}else{
|
||||
@ -166,31 +160,31 @@ class BidDocumentExaminationValidate extends BaseValidate
|
||||
}
|
||||
}
|
||||
if(empty($v['num'])){
|
||||
return '数量不能为空';
|
||||
return '审查明细列表第'.($k+1).'数量不能为空';
|
||||
}else{
|
||||
if(!is_numeric($v['num']) || $v['num'] < 0){
|
||||
return '数量必须是大于0的数字';
|
||||
return '审查明细列表第'.($k+1).'数量必须是大于0的数字';
|
||||
}
|
||||
}
|
||||
if(empty($v['cost_price'])){
|
||||
return '成本单价不能为空';
|
||||
return '审查明细列表第'.($k+1).'成本单价不能为空';
|
||||
}else{
|
||||
if(!is_numeric($v['cost_price']) || $v['cost_price'] < 0){
|
||||
return '成本单价必须是大于0的数字';
|
||||
return '审查明细列表第'.($k+1).'成本单价必须是大于0的数字';
|
||||
}
|
||||
}
|
||||
if(empty($v['sale_price'])){
|
||||
return '报价单价不能为空';
|
||||
return '审查明细列表第'.($k+1).'报价单价不能为空';
|
||||
}else{
|
||||
if(!is_numeric($v['sale_price']) || $v['sale_price'] < 0){
|
||||
return '报价单价必须是大于0的数字';
|
||||
return '审查明细列表第'.($k+1).'报价单价必须是大于0的数字';
|
||||
}
|
||||
}
|
||||
if(empty($v['points'])){
|
||||
return '点数不能为空';
|
||||
return '审查明细列表第'.($k+1).'点数不能为空';
|
||||
}else{
|
||||
if(!is_numeric($v['points']) || $v['points'] < 0){
|
||||
return '点数必须是大于0的数字';
|
||||
return '审查明细列表第'.($k+1).'点数必须是大于0的数字';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -105,15 +105,5 @@ class BidResultValidate extends BaseValidate
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function checkAnnex($value): bool|string
|
||||
{
|
||||
if(!empty($value) && $value != ''){
|
||||
if(!is_array($value)){
|
||||
return '附件格式错误';
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -74,10 +74,5 @@ class BidBiddingDecision extends BaseModel
|
||||
$is_internal_resources = [0=>'',1=>'有','2'=>'无'];
|
||||
return $is_internal_resources[$data['is_internal_resources']];
|
||||
}
|
||||
|
||||
public function getAnnexAttr($value)
|
||||
{
|
||||
return !empty($value) ? json_decode($value,true) : '';
|
||||
}
|
||||
|
||||
}
|
@ -36,10 +36,5 @@ class BidResult extends BaseModel
|
||||
$is_successful = [0=>'否', 1=>'是'];
|
||||
return $is_successful[$data['is_successful']];
|
||||
}
|
||||
|
||||
public function getAnnexAttr($value)
|
||||
{
|
||||
return !empty($value) ? json_decode($value,true) : '';
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user