Commit 7cdffa6b by 杨树贤

Merge branch 'master' into ysx-供应商需求-20220707

parents bacd3a18 11663ccf
......@@ -76,7 +76,7 @@ class Menu
],
[
'title' => '询报价管理',
'href' => 'http://frq.ichunt.net/inquiry/inquiryBoard',
'href' => 'http://frq.ichunt.net/?jumpUrl=/inquiry/inquiryBoard',
'class' => '',
'target' => '_blank',
'childs' => []
......
......@@ -16,6 +16,7 @@ use App\Model\SupplierAttachmentsModel;
use App\Model\SupplierChannelModel;
use App\Model\SupplierContactModel;
use App\Model\SupplierPayTypeModel;
use App\Model\UserInfoModel;
use Carbon\Carbon;
use GuzzleHttp\Client;
use GuzzleHttp\RequestOptions;
......@@ -662,18 +663,6 @@ class DataService
}
}
public function reSyncSupplierToErp()
{
ini_set('memory_limit', -1);
$suppliers = SupplierChannelModel::select(['supplier_id', 'supplier_name'])->where('is_type', 0)
->where('status', 2)->offset(200)->limit(200)->get()->toArray();
foreach ($suppliers as $supplier) {
if (!empty($supplier['supplier_name'])) {
echo "同步供应商到金蝶 : " . $supplier['supplier_name'] . PHP_EOL;
(new SyncSupplierService())->syncSupplierToErp($supplier['supplier_id']);
}
}
}
//导出重复的供应商
public function findDuplicateSupplier()
......@@ -708,5 +697,50 @@ class DataService
});
})->export('xlsx');
}
public function exportHalfYearSupplier()
{
$starTime = Carbon::now()->startOfYear()->timestamp;
$suppliers = SupplierChannelModel::where('create_time', '>=', $starTime)
->select([
'supplier_name',
'supplier_code',
'create_uid',
])->get();
$excelData = [];
$header = [
'供应商名字',
'编码',
'建档采购员',
'采购主管',
];
foreach ($suppliers as $supplier) {
$supervisor = '';
$user = UserInfoModel::where('userId', $supplier['create_uid'])->first();
$user = !empty($user) ? $user->toArray() : [];
$supervisorDepartmentId = $user['department_id'];
$positionId = \DB::table('user_position')->where('department_id', $supervisorDepartmentId)
->where('position_name', '采购总监')->value('position_id');
if (empty($positionId)) {
$positionId = \DB::table('user_position')
->where('position_name', '运营总监')->value('position_id');
}
$supervisor = UserInfoModel::where('position_id',$positionId)->value('name');
$excelData[] = [
$supplier['supplier_name'],
$supplier['supplier_code'],
array_get($user, 'name'),
$supervisor,
];
}
array_unshift($excelData, $header);
dd($excelData);
Excel::create('2022年新建供应商导出', function ($excel) use ($excelData) {
$excel->sheet('sheet1', function ($sheet) use ($excelData) {
$sheet->fromArray($excelData);
});
})->export('csv');
}
}
......@@ -59,7 +59,7 @@ class SupplierTransformer
$logModel = new LogModel();
$log = $logModel->where('supplier_id', $supplier['supplier_id'])
->where('type', LogModel::UPDATE_OPERATE)->orderBy('id', 'desc')->first();
$supplier['last_update_name'] = $log ? $log['admin_name']: '';
$supplier['last_update_name'] = $log ? $log['admin_name'] : '';
//黑名单
if (!empty($supplier['blacklist'])) {
$supplier['blacklist_name'] = $supplier['blacklist']['blacklist_name'];
......@@ -128,8 +128,8 @@ class SupplierTransformer
$supplier['region_name'] = array_get(config('fixed.Region'), $supplier['region']);
$supplier['currency_name'] = array_get(config('fixed.Currency'), $supplier['currency']);
$supplier['supplier_group_name'] = array_get(config('fixed.SupplierGroup'), $supplier['supplier_group']);
$supplier['is_business_abnormal_name'] = $supplier['is_business_abnormal'] == 1 ? '是' : '否';
$supplier['has_legal_ID_card_name'] = $supplier['has_legal_ID_card'] == 1 ? '是' : '否';
$supplier['is_business_abnormal_name'] = array_get($supplier, 'is_business_abnormal') == 1 ? '是' : '否';
$supplier['has_legal_ID_card_name'] = array_get($supplier, 'has_legal_ID_card') == 1 ? '是' : '否';
$supplier['pay_type_name'] = array_get(config('fixed.SupplierPayType'), $supplier['pay_type']);
$supplier['trading_method_name'] = array_get(config('fixed.TradingMethod'), $supplier['trading_method']);
if (isset($supplier['settlement_type'])) {
......
......@@ -123,15 +123,6 @@ class SupplierValidator
$errorMessageList[] = '该供应商是代购供应商,不能修改为临时供应商';
}
/**
* --->>附件必填要求:
* 如果供应商类别为正式供应商,营业执照必须上传(结算币种为人民币);
* 如果供应商类别为临时供应商,营业执照必须上传(结算币种为人民币),品质保证协议不需要上传
* 必须上传品质保证协议才能成为正式供应商,没有上传品质保证协议只能为临时供应商(代理商跟原厂类型的供应商不需要上传品质保证协议)。
* 供应商类型为代理商的,需要上传代理证才能成为正式供应商,没有上传代理证的只能为临时供应商。
* 非国内的供应商,商业登记证不能为空
**/
//只有在提交供应商是正式的时候,才会去校验附件
//校验附件这块,新增和修改判断的逻辑不一样
......@@ -147,8 +138,15 @@ class SupplierValidator
} else {
$attachmentFields = array_unique($attachmentFields);
//fixed.php FileNameMapping 可以知道所有对应关系
if (!in_array('business_license', $attachmentFields)) {
$errorMessageList[] = '营业执照必须上传';
if (!in_array('business_license', $attachmentFields)
&& $validateData['region'] == SupplierChannelModel::REGION_CN) {
$errorMessageList[] = '国内供应商必须上传营业执照';
}
if ($validateData['region'] != SupplierChannelModel::REGION_CN) {
if (!in_array('registration_certificate', $attachmentFields)) {
$errorMessageList[] = '海外供应商必须上传商业登记证/PI';
}
}
// if (!in_array('billing_information', $attachmentFields) && $validateData['currency'] == 1) {
......@@ -189,12 +187,6 @@ class SupplierValidator
}
}
// if ($validateData['region'] != 2) {
// if (!in_array('registration_certificate', $attachmentFields)) {
// $errorMessageList[] = '海外供应商必须上传商业登记证/PI';
// }
// }
}
......
......@@ -60,5 +60,5 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function ()
});
Route::match(['get', 'post'], '/test', function () {
// (new \App\Http\Services\DataService())->findDuplicateSupplier();
(new \App\Http\Services\DataService())->exportHalfYearSupplier();
});
......@@ -18,7 +18,7 @@ class MultiSelectorPresenter
$requiredHtml
$text</label>
<div class="layui-input-inline" style="margin-top: 0">
<div id="$elemId" class="layui-input-inline" value="$value" style="width: 158px;">
<div id="$elemId" class="layui-input-inline" value="$value" style="width: 157px;">
</div>
<input type="hidden" name="$name" id="$name" value="$value">
</div>
......
......@@ -81,26 +81,6 @@
});
});
//多加了个区分根据状态去筛选
$('.status_filter').click(function () {
clearTypeFilter();
$(this).attr('class', 'status_filter layui-badge layui-bg-green');
type = $(this).attr('id');
whereCondition.source_type = type
//先清空状态
whereCondition.status = 0;
let status = $(this).attr('data-value');
whereCondition.status = status;
table.reload('list', {
page: {
curr: 1
}
, where: whereCondition
});
//同时还要去联动下面的状态筛选
$('#status').val(status);
form.render('select')
});
let cols = [
{type: 'checkbox', fixed: true},
......@@ -608,7 +588,7 @@
form.on('submit(load)', function (data) {
//罗盘选项会跳回全部
clearTypeFilter();
$('#total').attr('class', 'status_filter layui-badge layui-bg-green');
$('#total').attr('class', 'main_filter layui-badge layui-bg-green');
whereCondition.source_type = 'all';
initCondition.source_type = whereCondition.source_type;
whereCondition = $.extend(false, initCondition, data.field);
......@@ -659,7 +639,6 @@
function clearTypeFilter() {
$('.main_filter').attr('class', 'main_filter');
$('.status_filter').attr('class', 'status_filter');
}
//批量修改供应商标签
......
......@@ -81,9 +81,14 @@
<button type="button" class="layui-btn layui-btn submit-loading" lay-submit
lay-filter="updateSupplier">确认修改供应商
</button>
<button type="button" class="layui-btn layui-btn submit-loading" lay-submit
lay-filter="applyAuditSupplier">申请审核
</button>
@if ($supplier['status'] == \App\Model\SupplierChannelModel::STATUS_PASSED && checkPerm('IgnoreUpdateAudit'))
@else
<button type="button" class="layui-btn layui-btn submit-loading" lay-submit
lay-filter="applyAuditSupplier">申请审核
</button>
@endif
@endif
<a id="supplierDetailUrl"
href="/supplier/SupplierDetail?view=iframe&supplier_id={{$supplier['supplier_id']}}"
......
......@@ -2,10 +2,6 @@
.main_filter {
cursor: pointer;
}
.status_filter {
cursor: pointer;
}
</style>
<div class="layui-fluid" id="type_filter">
<div class="layui-card">
......@@ -18,30 +14,30 @@
</div>
<div class="split-item" id="s2" style="text-align: center">
<div class="layui-row">
<a class="status_filter" id="need_review" data-value="-1">
<a class="main_filter" id="need_review" data-value="-1">
</a>
</div>
@if(checkPerm('SupplierPendingList'))
<div class="layui-row">
<a class="status_filter" id="pending" data-value="0">
<a class="main_filter" id="pending" data-value="0">
</a>
</div>
@endif
@if(checkPerm('SupplierInReviewList'))
<div class="layui-row">
<a class="status_filter" id="in_review" data-value="1">
<a class="main_filter" id="in_review" data-value="1">
</a>
</div>
@endif
@if(checkPerm('SupplierRejectList'))
<div class="layui-row">
<a class="status_filter" id="rejected" data-value="3">
<a class="main_filter" id="rejected" data-value="3">
</a>
</div>
@endif
@if(checkPerm('SupplierPassedList'))
<div class="layui-row">
<a class="status_filter" id="passed" data-value="2">
<a class="main_filter" id="passed" data-value="2">
</a>
</div>
@endif
......@@ -102,13 +98,13 @@
<div class="split-item" id="s5" style="text-align: center">
@if(checkPerm('SupplierBlockList'))
<div class="layui-row">
<a class="status_filter" id="block" data-value="-3">
<a class="main_filter" id="block" data-value="-3">
</a>
</div>
@endif
@if(checkPerm('SupplierDisableList'))
<div class="layui-row">
<a class="status_filter" id="disable" data-value="-2">
<a class="main_filter" id="disable" data-value="-2">
</a>
</div>
@endif
......@@ -145,7 +141,6 @@
<?php
$routerName = explode('/', request()->path())[1];
?>
<div class="layui-row">
<div class="layui-inline">
@inject('multiTransformableSelectPresenter','App\Presenters\Filter\MultiTransformableSelectPresenter')
{!! $multiTransformableSelectPresenter->render(['supplier_group'=>'供应商性质','company_nature'=>'公司实际性质'],
......@@ -167,8 +162,6 @@
@inject('transformableSelectPresenter','App\Presenters\Filter\TransformableSelectPresenter')
{!! $transformableSelectPresenter->render(['channel_uid'=>'采购员','purchase_uid'=>'开发员','create_uid'=>'创建人'],$userCodes) !!}
</div>
</div>
<div class="layui-row">
<div class="layui-inline">
@inject('multiTransformableSelectPresenter','App\Presenters\Filter\MultiTransformableSelectPresenter')
{!! $multiTransformableSelectPresenter->render(['has_sku'=>'SKU上传','sku_tag'=>'SKU标准','sku_mode'=>'SKU模式','uploaded_sku' => '历史SKU合作','outside_contact_type' => 'SKU上传方式'],
......@@ -186,7 +179,6 @@
@inject('transformableTimeIntervalPresenter','App\Presenters\Filter\TransformableTimeIntervalPresenter')
{!! $transformableTimeIntervalPresenter->render(['update_time'=>'更新时间','create_time'=>'创建时间']) !!}
</div>
</div>
<div class="layui-row" style="margin-top:10px;margin-bottom: 10px;margin-left: 20px;">
<button class="layui-btn layui-btn-sm layui-btn load" id="getSupplierListButton" lay-submit=""
lay-filter="load">查询
......
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