Commit d43b3261 by 杨树贤

Merge branch 'ysx-协议相关改动-20250811' into Dev

parents 51f527e2 9939d159
......@@ -8,4 +8,5 @@ Homestead.json
/vendor/_laravel_idea/*
/vendor/_laravel_idea
/vendor/_laravel_ide
/storage/framework/views
\ No newline at end of file
/storage/framework/views
/storage
......@@ -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"');
......@@ -270,7 +331,7 @@ class SupplierFilter
}
});
$query->with(['contact', 'attachment']);
$query->with(['contact', 'attachment','yunxin_account']);
$query->whereRaw('supplier_name NOT LIKE "%-1"');
// 权限逻辑已经移到上面的复合查询条件中
......
......@@ -872,12 +872,13 @@ class DataService
}
}
public static function repaireSkuUploadRuler()
//同步供应商到erp
public static function syncSupplierToErp()
{
ini_set('memory_limit', '2048M');
$supplierList = SupplierChannelModel::where('is_type', 0)->orderBy('supplier_id', 'desc')->get()->toArray();
foreach ($supplierList as $supplier) {
(new SupplierService())->saveSkuUploadRulerToRedis($supplier['supplier_id'], $supplier['sku_upload_ruler']);
$supplierIds = SupplierChannelModel::where('is_type', 0)->where('group_code', '!=', '')
->pluck('supplier_id')->toArray();
foreach ($supplierIds as $supplierId) {
(new SyncSupplierService())->syncSupplierToErp($supplierId);
}
}
}
......@@ -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();
......
......@@ -91,6 +91,18 @@ class SyncSupplierService
$message['country_isocode'] = $countryIsocode;
}
$message['isSignatures'] = 0;
$message['signatures'] = '';
//去判断是否有云芯协议
$signatures = SupplierAttachmentsModel::where('supplier_id', $supplier['supplier_id'])
->where('field_name', 'yunxin_agreement')->orderBy('id', 'desc')->first();
if (!empty($signatures)) {
$signatures = $signatures->toArray();
$message['isSignatures'] = 1;
$message['signatures'] = $signatures['file_url'];
}
$supplierIds = SupplierChannelModel::where('supplier_name', $supplier['supplier_name'])
->where('is_type', 0)->where('group_code', '!=', '')
->pluck('supplier_id')->toArray();
......
......@@ -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'] = '无';
}
......
<?php
namespace App\Model\Purchase;
use Illuminate\Database\Eloquent\Model;
class PurchaseContract extends Model
{
protected $connection='purchase';
protected $table='purchase_contract';
public $timestamps = false;
}
......@@ -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,32 @@
width: 120,
},
{
field: 'has_yunxin_agreement',
title: '采购合作框架协议',
align: 'center',
width: 140,
},
//启用芯链账号
{
field: 'has_supplier_account',
title: '启用芯链账号',
align: 'center',
width: 120,
templet: function (data) {
return data.yunxin_account ? '是' : '否';
}
},
//通过芯链上传合同
{
field: 'has_order_contract',
title: '通过芯链上传合同',
align: 'center',
width: 120,
templet: function (data) {
return data.has_order_contract ? '是' : '否';
}
},
{
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>
......
......@@ -236,6 +236,22 @@
</div>
<div class="layui-inline">
<?php $multiTransformableSelectPresenter = app('App\Presenters\Filter\MultiTransformableSelectPresenter'); ?>
<?php echo $multiTransformableSelectPresenter->render(['has_yunxin_agreement'=>'采购合作框架协议'],
['has_yunxin_agreement'=>[1=>'有',-1=>'无']]); ?>
</div>
<div class="layui-inline">
<?php $statusPresenter = app('App\Presenters\StatusPresenter'); ?>
<?php echo $statusPresenter->render('has_supplier_account','启用芯链账号','',[1=>'是',-1=>'否']); ?>
</div>
<div class="layui-inline">
<?php $statusPresenter = app('App\Presenters\StatusPresenter'); ?>
<?php echo $statusPresenter->render('has_order_contract','通过芯链上传合同','',[1=>'有',-1=>'无']); ?>
</div>
<div class="layui-inline">
<?php $statusPresenter = app('App\Presenters\StatusPresenter'); ?>
<?php echo $statusPresenter->render('is_entity','实体名单','',config('field.IsEntity')); ?>
......
......@@ -176,6 +176,32 @@
width: 120,
},
{
field: 'has_yunxin_agreement',
title: '采购合作框架协议',
align: 'center',
width: 140,
},
//启用芯链账号
{
field: 'has_supplier_account',
title: '启用芯链账号',
align: 'center',
width: 120,
templet: function (data) {
return data.yunxin_account ? '是' : '否';
}
},
//通过芯链上传合同
{
field: 'has_order_contract',
title: '通过芯链上传合同',
align: 'center',
width: 120,
templet: function (data) {
return data.has_order_contract ? '是' : '否';
}
},
{
field: 'channel_username', title: '采购员', align: 'center', width: 130, templet: function (data) {
if (data.resign_channel_username) {
if (data.on_job_channel_username) {
......
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