Commit cc223814 by 杨树贤

Merge branch 'ysx-供应商类型-20220614' into ysx-供应商新需求-20220627

parents 063befa4 b7a2d47c
......@@ -72,7 +72,9 @@ class CommonApiController extends Controller
//请求天眼查校验接口
$supplierName = $request->get('supplier_name');
$taxNumber = $request->get('tax_number');
$company = (new CompanyService())->getCompanyInfo($supplierName, $taxNumber);
$region = $request->get('region');
$regionType = $region == 2 ? 1 : 2;
$company = (new CompanyService())->getCompanyInfo($supplierName, $taxNumber, $regionType);
if (!$company) {
$this->response(-1, '获取不到公司');
}
......
......@@ -142,6 +142,10 @@ class SupplierApiController extends Controller
]);
$channel = $request->only($channelMap);
//如果是有直接新增权限的(绕过天眼查等校验)
if (checkPerm('IgnoreCompanyCheck')) {
$channel['is_standard_add'] = -1;
}
$service = new SupplierService();
$supplierId = $service->saveSupplier($channel);
if (!$supplierId) {
......
......@@ -307,6 +307,9 @@ class SupplierFilter
break;
case "level_a":
$query->where('level', 'A');
break;
case "pay_type_term":
$query->where('pay_type', 1);
}
return $query;
}
......
......@@ -79,8 +79,10 @@ class SupplierAuditService
//发送队列消息同步到金蝶
$service = new SyncSupplierService();
$service->syncSupplierToErp($supplierId);
//同步给一体化系统
(new SyncSupplierService())->syncSupplierToUnited($supplierId);
if ($status == SupplierChannelModel::STATUS_PASSED ) {
//同步给一体化系统
(new SyncSupplierService())->syncSupplierToUnited($supplierId);
}
}
return $result;
}
......
......@@ -55,6 +55,8 @@ class SupplierStatisticsService
//历史检测异常
$historyAbnormal = $this->getStatisticsCount('history_abnormal');
//战略供应商(等级为A)
$payTypeTerm = $this->getStatisticsCount('pay_type_term');
//账期供应商
$levelA = $this->getStatisticsCount('level_a');
$result = [
'total' => $total,
......@@ -75,6 +77,7 @@ class SupplierStatisticsService
'has_supplier_tag' => $hasTagSupplier,
'contact_no_complete' => $concatNoComplete,
'history_abnormal' => $historyAbnormal,
'pay_type_term' => $payTypeTerm,
'level_a' => $levelA,
];
$result = array_map(function ($value) {
......
......@@ -152,11 +152,21 @@ class SyncSupplierService
$groupCode = array_get($syncResult, 'group_code');
$sourceSn = array_get($syncResult, 'source_sn');
$supplierId = $sourceSn;
return SupplierChannelModel::where('supplier_id', $supplierId)
->update([
'sync_united_status' => SupplierChannelModel::SYNC_UNITED_STATUS_OK,
'group_code' => $groupCode,
'company_nature' => $syncResult['company_nature'],
]);
if ($supplierId) {
return SupplierChannelModel::where('supplier_id', $supplierId)
->update([
'sync_united_status' => SupplierChannelModel::SYNC_UNITED_STATUS_OK,
'group_code' => $groupCode,
'company_nature' => $syncResult['company_nature'],
]);
}else{
return SupplierChannelModel::where('group_code', $groupCode)
->update([
'sync_united_status' => SupplierChannelModel::SYNC_UNITED_STATUS_OK,
'group_code' => $groupCode,
'company_nature' => $syncResult['company_nature'],
]);
}
}
}
\ No newline at end of file
......@@ -60,5 +60,6 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function ()
});
Route::match(['get', 'post'], '/test', function () {
(new \App\Http\Services\SyncSupplierService())->syncSupplierToUnited(12421);
$resut = json_decode('{"group_code":"G000010","source_sn":0,"company_name":"深圳大事件科技有限公司","init_nature":"原厂","company_nature":"方案商","company_type":2}',true);
dd((new \App\Http\Services\SyncSupplierService())->syncSupplierToUnitedResult($resut));
});
......@@ -49,7 +49,7 @@ class BrandSelectorPresenter
page: pageIndex
},
dataType: 'json',
timeout: 10000,
timeout: 20000,
success: function (res) {
if (!res) return layer.msg('网络错误,请重试', {icon: 5});
if (res.code === 0) {
......
......@@ -236,6 +236,7 @@ return [
'has_supplier_tag' => '客户指定供应商',
'history_abnormal' => '历史检测异常',
'level_a' => '战略供应商',
'pay_type_term' => '账期供应商',
],
//Sku列表的罗盘对应菜单id
'SkuListCompassMenuMap' => [
......
......@@ -67,7 +67,7 @@ function ajax(url, data) {
data: data,
async: false,
dataType: 'json',
timeout: 10000,
timeout: 20000,
success: function (resp) {
if (resp) {
result = resp;
......
......@@ -69,7 +69,7 @@
page: pageIndex
},
dataType: 'json',
timeout: 10000,
timeout: 20000,
success: function (res) {
if (!res) return layer.msg('网络错误,请重试', {icon: 5});
if (res.errcode === 0) {
......
......@@ -27,7 +27,7 @@
type: 'post',
async: true,
dataType: 'json',
timeout: 10000,
timeout: 20000,
success: function (res) {
if (res.err_code === 0) {
$.each(res.data, function (index, value) {
......
......@@ -46,10 +46,8 @@
type: 'GET',
async: true,
dataType: 'json',
timeout: 10000,
timeout: 20000,
success: function (res) {
console.log(supplier_name);
console.log(tax_number);
if (supplier_name !== '' || tax_number !== '') {
if (res.err_code !== 0) {
//当code=-2的时候,是公司信息校验有问题,但是如果有跳过检查权限,那么就什么都不处理
......@@ -67,8 +65,11 @@
"<p style='color: red;'>" + res.err_msg + "</p></div>");
$('#supplier_name').prop('disabled', false);
}
//监听是不是供应商名称变化
resetCompanyInfo(self.attr('id') === 'supplier_name');
if (!ignoreCompanyCheck) {
//监听是不是供应商名称变化
resetCompanyInfo(self.attr('id') === 'supplier_name');
}
} else if (res.err_code === 0) {
//如果供应商没有问题,就要去自动填补部分资料
let companyInfo = res.data;
......@@ -78,11 +79,14 @@
$('#supplier_address').val(companyInfo.supplier_address);
$('#registered_capital').val(companyInfo.registered_capital);
layer.msg('校验公司信息通过,自动补全相关数据', {icon: 6})
if (self.attr('id') === 'supplier_name') {
$('#tax_number').attr('disabled', true);
} else {
$('#supplier_name').attr('disabled', true);
if (!ignoreCompanyCheck) {
if (self.attr('id') === 'supplier_name') {
$('#tax_number').attr('disabled', true);
} else {
$('#supplier_name').attr('disabled', true);
}
}
}
}
......@@ -278,6 +282,7 @@
$('#recheck_company_info').click(function () {
let supplierName = $('#supplier_name').val();
let taxNumber = $('#tax_number').val();
let region = $('#region').val();
admin.btnLoading('#recheck_company_info', '正在查验公司信息,请稍等...');
if (!supplierName && !taxNumber) {
layer.msg('请填写供应商名称或者税号后再进行查验', {icon: 5});
......@@ -285,13 +290,13 @@
return false;
}
$('#supplier_check_tip').remove();
let url = '/api/common/checkCompanyInfo?supplier_name=' + supplierName + '&tax_number=' + taxNumber;
let url = '/api/common/checkCompanyInfo?supplier_name=' + supplierName + '&tax_number=' + taxNumber + '&region=' + region;
$.ajax({
url: url,
type: 'GET',
async: true,
dataType: 'json',
timeout: 10000,
timeout: 20000,
success: function (res) {
admin.btnLoading('#recheck_company_info', false);
if (res.err_code === 0) {
......@@ -306,7 +311,7 @@
layer.msg('验证成功,校验公司信息通过,自动补全相关数据', {icon: 6})
} else {
if (ignoreCompanyCheck) {
layer.msg('公司未进行工商注册', {icon: 5})
} else {
$('#supplier_name').after("<div id='supplier_check_tip' style='margin-top: 5px'>" +
"<p style='color: red;'>公司未进行工商注册,请修改后重新提交</p></div>");
......
......@@ -54,11 +54,11 @@
<label class="layui-form-label"><span class="require">*</span>供应商名称 : </label>
<div class="layui-input-block">
<input type="text" name="supplier_name" id="supplier_name"
placeholder="请输入供应商名称" class="layui-input @if ($supplier['sync_united_status']==1)
placeholder="请输入供应商名称" class="layui-input @if ($supplier)
layui-disabled
@endif"
value="{{$supplier['supplier_name'] or ''}}"
@if ($supplier['sync_united_status']==1) disabled @endif>
@if ($supplier) disabled @endif>
</div>
</div>
<div class="layui-col-md5">
......
......@@ -126,6 +126,10 @@
<a class="main_filter" title="战略供应商" id="level_a">
</a>
</div>
<div class="layui-row">
<a class="main_filter" title="账期供应商" id="pay_type_term">
</a>
</div>
</div>
<div class="split-item" id="s7" style="text-align: center">
......
......@@ -26,11 +26,26 @@
value="{{$supplier['pay_type_value'] or ''}}">
<select lay-filter="pay_type_month">
<option value="">请选择</option>
<option value="7"
@if($supplier['pay_type_value']==7)
selected='selected'
@endif>7
</option>
<option value="15"
@if($supplier['pay_type_value']==15)
selected='selected'
@endif>15
</option>
<option value="30"
@if($supplier['pay_type_value']==30)
selected='selected'
@endif>30
</option>
<option value="45"
@if($supplier['pay_type_value']==45)
selected='selected'
@endif>45
</option>
<option value="60"
@if($supplier['pay_type_value']==60)
selected='selected'
......@@ -55,7 +70,10 @@
<input class="layui-input valueInput" type="hidden" name="pay_type_value">
<select lay-filter="pay_type_month">
<option value="">请选择</option>
<option value="30">7</option>
<option value="30">15</option>
<option value="30">30</option>
<option value="30">45</option>
<option value="60">60</option>
<option value="90">90</option>
</select>
......
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