Commit 02ba806d by 杨树贤

修复脚本

parent 51cdff1d
......@@ -38,11 +38,11 @@ class DataService
{
$tagList = [
// 1 => '临时供应商',
// 2 => '优质供应商',
// 3 => '客户指定供应商',
// 4 => '开票不及时',
// 5 => '跳票',
// 1 => '临时供应商',
// 2 => '优质供应商',
// 3 => '客户指定供应商',
// 4 => '开票不及时',
// 5 => '跳票',
'战略供应商',
];
......@@ -98,8 +98,10 @@ class DataService
$users = $intraCodeModel->getSampleName(true);
foreach ($suppliers as $supplier) {
$mainBrands = (new SupplierTransformer())->getMainBrandNames($supplier['main_brands']);
$attachmentsField = SupplierAttachmentsModel::where('supplier_id',
$supplier['supplier_id'])->pluck('field_name')->toArray();
$attachmentsField = SupplierAttachmentsModel::where(
'supplier_id',
$supplier['supplier_id']
)->pluck('field_name')->toArray();
$hasPinzhi = $hasHezuo = '否';
if (in_array('quality_assurance_agreement', $attachmentsField)) {
$hasPinzhi = '是';
......@@ -126,8 +128,10 @@ class DataService
->groupBy('purchase_uid')->orderBy('purchase_order_num', 'DESC')->first();
if (!empty($mostPurchaseOrderUser)) {
$mostPurchaseOrderUser = $mostPurchaseOrderUser->toArray();
$codeId = IntracodeModel::where('admin_id',
$mostPurchaseOrderUser['purchase_uid'])->value('code_id');
$codeId = IntracodeModel::where(
'admin_id',
$mostPurchaseOrderUser['purchase_uid']
)->value('code_id');
if ($codeId) {
$skuUserNameRaw = array_get($users, $codeId);
$skuUserName = $skuUserNameRaw . '(采购系统下单最多)';
......@@ -444,7 +448,6 @@ class DataService
});
}
})->export('xlsx');
}
function syncDaigouSuppliersToErp()
......@@ -490,9 +493,7 @@ class DataService
$excel->sheet('sheet1', function ($sheet) use ($excelData) {
$sheet->fromArray($excelData);
});
})->save('xlsx');
}
function exportSupplier()
......@@ -567,7 +568,6 @@ class DataService
$suppliers = array_merge($suppliers, $supplierList);
}
}
}
$idColumn = array_column($suppliers, 'supplier_name');
......@@ -594,9 +594,7 @@ class DataService
$excel->sheet('sheet1', function ($sheet) use ($excelData) {
$sheet->fromArray($excelData);
});
})->save('xlsx');
}
public static function checkSupplierBandAccount()
......@@ -615,15 +613,11 @@ class DataService
'account_no' => $accountNo,
]);
}
}
}
}
public static function exportInvalidSupplierName()
{
}
public static function exportInvalidSupplierName() {}
public static function repairAccount()
{
......@@ -669,7 +663,6 @@ class DataService
$excel->sheet('sheet1', function ($sheet) use ($excelData) {
$sheet->fromArray($excelData);
});
})->export('csv');
}
......@@ -710,7 +703,6 @@ class DataService
}
});
});
}
public static function initSignCom()
......@@ -722,20 +714,19 @@ class DataService
$sheet->fromArray($sheet->toArray());
});
});
}
public static function deleteSupplierContract()
{
SupplierContractModel::where('id', 10)->delete();
SupplierContractModel::where('id', 10)->delete();
}
public static function repairSupplierChannel()
{
SupplierChannelModel::where('supplier_id',272)->update([
'is_entity' => -1,
'status' => 2,
]);
SupplierChannelModel::where('supplier_id', 272)->update([
'is_entity' => -1,
'status' => 2,
]);
}
public static function batchSetPurchaseType()
......@@ -782,11 +773,36 @@ class DataService
continue;
}
if ($supplier) {
SupplierChannelModel::where('supplier_name', $supplierName)->update([
SupplierChannelModel::where('supplier_name', $supplierName)->update([
'purchase_type' => 2,
]);
]);
}
}
}
public static function repairSupplierCpTime()
{
$isUpdate = request()->get('is_update', false);
ini_set('memory_limit', '2048M');
//倒序供应商
$suppliers = SupplierChannelModel::orderBy('supplier_id', 'desc')->get()->toArray();
$redis = new RedisModel();
foreach ($suppliers as $supplier) {
//检测cp_time是否为空
$ruler = $redis->hget('supplier_sku_upload_ruler_v2', $supplier['supplier_id']);
if (empty($ruler)) {
$cpTimeDay = $supplier['cp_time_day'];
$futuresCpTimeDay = $supplier['futures_cp_time_day'];
$data = [
'upload_validity_period' => $cpTimeDay,
'upload_futures_goods_validity_period' => $futuresCpTimeDay,
];
if ($isUpdate) {
$redis->hset('supplier_sku_upload_ruler_v2', $supplier['supplier_id'], json_encode($data));
}
\dump($supplier['supplier_id'], $data);
}
continue;
}
}
}
......@@ -90,5 +90,5 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function ()
});
Route::match(['get', 'post'], '/test', function () {
DataService::batchSetPurchaseType();
DataService::repairSupplierCpTime();
});
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