Commit 8a0022b4 by 杨树贤

协议改动相关内容

parent 3d7ac1b2
......@@ -4,13 +4,16 @@
namespace App\Http\Controllers\Filter;
use App\Http\Services\AdminUserService;
use App\Http\Services\DepartmentService;
use App\Model\DepartmentModel;
use App\Model\SupplierAttachmentsModel;
use App\Model\SupplierChannelModel;
use App\Model\UserInfoModel;
use App\Model\DepartmentModel;
use Illuminate\Support\Facades\DB;
use App\Model\SupplierAccountModel;
use App\Model\SupplierChannelModel;
use App\Http\Services\AdminUserService;
use App\Model\SupplierAttachmentsModel;
use App\Http\Services\DepartmentService;
use App\Model\Purchase\PurchaseContract;
use App\Model\Purchase\PurchaseOrderModel;
class SupplierFilter
{
......@@ -194,6 +197,18 @@ class SupplierFilter
}
}
if (!empty($map['has_yunxin_agreement'])) {
if ($map['has_yunxin_agreement'] == 1) {
$query->whereIn('supplier_id', function ($query) {
$query->select('supplier_id')->from(with(new SupplierAttachmentsModel())->getTable())->where('field_name', 'yunxin_agreement');
});
} else {
$query->whereNotIn('supplier_id', function ($query) {
$query->select('supplier_id')->from(with(new SupplierAttachmentsModel())->getTable())->where('field_name', 'yunxin_agreement');
});
}
}
//搜索创建部门的数据
if (!empty($map['create_user_department'])) {
$map['create_user_department'] = explode(',', $map['create_user_department']);
......@@ -206,6 +221,52 @@ class SupplierFilter
$query->whereIn('create_uid', $userIds);
}
//搜索是否有供应商账号
if (!empty($map['has_supplier_account'])) {
$query->has('yunxin_account');
}
//搜索是否有合同
if (!empty($map['has_contract'])) {
$query->has('contract');
}
//判断是否有采购合同
//供应商下所有芯链账号,已采购订单的采购合同,存在以下类型的合同( 满足任意一个条件即可):
// 1、类型为电子签,且签署状态为:已签署
// 2、类型为人工上传,有合同附件,且上传人是:云芯系统供应商
if (!empty($map['has_order_contract'])) {
$purchaseIds = PurchaseContract::query()
->where('sign_status', 3)
->where(function ($query) {
// 1、类型为电子签,且签署状态为:已签署
$query->where(function ($q) {
$q->where('contract_type', 2)->where('sign_status', 3);
});
// 2、类型为人工上传,有合同附件,且上传人是:云芯系统供应商
$query->orWhere(function ($q) {
$q->where('contract_type', 1)
->where('create_name', '云芯系统供应商')
->where('contract_file_url', '!=', '');
});
})->pluck('purchase_id');
if ($purchaseIds->isEmpty()) {
} else {
$supplierIds = PurchaseOrderModel::query()
->whereIn('purchase_id', $purchaseIds)
->distinct()
->pluck('supplier_id')->unique();
if ($supplierIds->isEmpty()) {
} else {
$query->whereIn('supplier_id', $supplierIds);
}
}
}
//默认过滤带有-1字符串的供应商名称的数据
$query->whereRaw('supplier_name NOT LIKE "%-1"');
......
......@@ -36,8 +36,8 @@ class SupplierService
if (!empty($map['is_export'])) {
$list = $query->get()->toArray();
} else {
$sql = $query->toSql();
$bindings = $query->getBindings();
// $sql = $query->toSql();
// $bindings = $query->getBindings();
// dd($sql, $bindings);
$list = $query->paginate($limit)->toArray();
$transformer = new SupplierTransformer();
......
......@@ -77,6 +77,7 @@ class SupplierTransformer
if (isset($supplier['attachment'])) {
$supplier['has_quality_assurance_agreement'] = $this->checkHasSpecificAttachment('quality_assurance_agreement', $supplier['attachment']) ? '有' : '无';
$supplier['has_cooperation_agreement'] = $this->checkHasSpecificAttachment('cooperation_agreement', $supplier['attachment']) ? '有' : '无';
$supplier['has_yunxin_agreement'] = $this->checkHasSpecificAttachment('yunxin_agreement', $supplier['attachment']) ? '有' : '无';
} else {
$supplier['has_quality_assurance_agreement'] = '无';
}
......
......@@ -81,4 +81,14 @@ class SupplierChannelModel extends Model
return $this->hasMany(SupplierReceiptModel::class, 'supplier_id', 'supplier_id');
}
public function yunxin_account()
{
return $this->hasOne(SupplierAccountModel::class, 'supplier_id', 'supplier_id');
}
public function contract()
{
return $this->hasOne(SupplierContractModel::class, 'supplier_id', 'supplier_id');
}
}
......@@ -236,7 +236,7 @@ return [
'certification_notice' => '认证通知书',
'supplier_survey' => '供应商调查表',
'confidentiality_agreement' => '保密协议',
'yunxin_agreement' => '芯链合作协议',
'yunxin_agreement' => '采购合作框架协议',
'other_attachment' => '其它附件',
],
......
......@@ -176,6 +176,12 @@
width: 120,
},
{
field: 'has_yunxin_agreement',
title: '采购合作框架协议',
align: 'center',
width: 140,
},
{
field: 'channel_username', title: '采购员', align: 'center', width: 130, templet: function (data) {
if (data.resign_channel_username) {
if (data.on_job_channel_username) {
......
......@@ -215,6 +215,19 @@
['has_cooperation_agreement'=>[1=>'是',-1=>'否']]) !!}
</div>
<div class="layui-inline">
@inject('multiTransformableSelectPresenter','App\Presenters\Filter\MultiTransformableSelectPresenter')
{!! $multiTransformableSelectPresenter->render(['has_yunxin_agreement'=>'采购合作框架协议'],
['has_yunxin_agreement'=>[1=>'有',-1=>'无']]) !!}
</div>
<div class="layui-inline">
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('has_supplier_account','启用芯链账号','',[1=>'是',-1=>'否']) !!}
</div>
<div class="layui-inline">
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('has_order_contract','通过芯链上传合同','',[1=>'有',-1=>'无']) !!}
</div>
<div class="layui-inline">
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('is_entity','实体名单','',config('field.IsEntity')) !!}
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment