Commit 02ba806d by 杨树贤

修复脚本

parent 51cdff1d
...@@ -38,11 +38,11 @@ class DataService ...@@ -38,11 +38,11 @@ class DataService
{ {
$tagList = [ $tagList = [
// 1 => '临时供应商', // 1 => '临时供应商',
// 2 => '优质供应商', // 2 => '优质供应商',
// 3 => '客户指定供应商', // 3 => '客户指定供应商',
// 4 => '开票不及时', // 4 => '开票不及时',
// 5 => '跳票', // 5 => '跳票',
'战略供应商', '战略供应商',
]; ];
...@@ -98,8 +98,10 @@ class DataService ...@@ -98,8 +98,10 @@ class DataService
$users = $intraCodeModel->getSampleName(true); $users = $intraCodeModel->getSampleName(true);
foreach ($suppliers as $supplier) { foreach ($suppliers as $supplier) {
$mainBrands = (new SupplierTransformer())->getMainBrandNames($supplier['main_brands']); $mainBrands = (new SupplierTransformer())->getMainBrandNames($supplier['main_brands']);
$attachmentsField = SupplierAttachmentsModel::where('supplier_id', $attachmentsField = SupplierAttachmentsModel::where(
$supplier['supplier_id'])->pluck('field_name')->toArray(); 'supplier_id',
$supplier['supplier_id']
)->pluck('field_name')->toArray();
$hasPinzhi = $hasHezuo = '否'; $hasPinzhi = $hasHezuo = '否';
if (in_array('quality_assurance_agreement', $attachmentsField)) { if (in_array('quality_assurance_agreement', $attachmentsField)) {
$hasPinzhi = '是'; $hasPinzhi = '是';
...@@ -126,8 +128,10 @@ class DataService ...@@ -126,8 +128,10 @@ class DataService
->groupBy('purchase_uid')->orderBy('purchase_order_num', 'DESC')->first(); ->groupBy('purchase_uid')->orderBy('purchase_order_num', 'DESC')->first();
if (!empty($mostPurchaseOrderUser)) { if (!empty($mostPurchaseOrderUser)) {
$mostPurchaseOrderUser = $mostPurchaseOrderUser->toArray(); $mostPurchaseOrderUser = $mostPurchaseOrderUser->toArray();
$codeId = IntracodeModel::where('admin_id', $codeId = IntracodeModel::where(
$mostPurchaseOrderUser['purchase_uid'])->value('code_id'); 'admin_id',
$mostPurchaseOrderUser['purchase_uid']
)->value('code_id');
if ($codeId) { if ($codeId) {
$skuUserNameRaw = array_get($users, $codeId); $skuUserNameRaw = array_get($users, $codeId);
$skuUserName = $skuUserNameRaw . '(采购系统下单最多)'; $skuUserName = $skuUserNameRaw . '(采购系统下单最多)';
...@@ -444,7 +448,6 @@ class DataService ...@@ -444,7 +448,6 @@ class DataService
}); });
} }
})->export('xlsx'); })->export('xlsx');
} }
function syncDaigouSuppliersToErp() function syncDaigouSuppliersToErp()
...@@ -490,9 +493,7 @@ class DataService ...@@ -490,9 +493,7 @@ class DataService
$excel->sheet('sheet1', function ($sheet) use ($excelData) { $excel->sheet('sheet1', function ($sheet) use ($excelData) {
$sheet->fromArray($excelData); $sheet->fromArray($excelData);
}); });
})->save('xlsx'); })->save('xlsx');
} }
function exportSupplier() function exportSupplier()
...@@ -567,7 +568,6 @@ class DataService ...@@ -567,7 +568,6 @@ class DataService
$suppliers = array_merge($suppliers, $supplierList); $suppliers = array_merge($suppliers, $supplierList);
} }
} }
} }
$idColumn = array_column($suppliers, 'supplier_name'); $idColumn = array_column($suppliers, 'supplier_name');
...@@ -594,9 +594,7 @@ class DataService ...@@ -594,9 +594,7 @@ class DataService
$excel->sheet('sheet1', function ($sheet) use ($excelData) { $excel->sheet('sheet1', function ($sheet) use ($excelData) {
$sheet->fromArray($excelData); $sheet->fromArray($excelData);
}); });
})->save('xlsx'); })->save('xlsx');
} }
public static function checkSupplierBandAccount() public static function checkSupplierBandAccount()
...@@ -615,15 +613,11 @@ class DataService ...@@ -615,15 +613,11 @@ class DataService
'account_no' => $accountNo, 'account_no' => $accountNo,
]); ]);
} }
} }
} }
} }
public static function exportInvalidSupplierName() public static function exportInvalidSupplierName() {}
{
}
public static function repairAccount() public static function repairAccount()
{ {
...@@ -669,7 +663,6 @@ class DataService ...@@ -669,7 +663,6 @@ class DataService
$excel->sheet('sheet1', function ($sheet) use ($excelData) { $excel->sheet('sheet1', function ($sheet) use ($excelData) {
$sheet->fromArray($excelData); $sheet->fromArray($excelData);
}); });
})->export('csv'); })->export('csv');
} }
...@@ -710,7 +703,6 @@ class DataService ...@@ -710,7 +703,6 @@ class DataService
} }
}); });
}); });
} }
public static function initSignCom() public static function initSignCom()
...@@ -722,7 +714,6 @@ class DataService ...@@ -722,7 +714,6 @@ class DataService
$sheet->fromArray($sheet->toArray()); $sheet->fromArray($sheet->toArray());
}); });
}); });
} }
public static function deleteSupplierContract() public static function deleteSupplierContract()
...@@ -732,7 +723,7 @@ class DataService ...@@ -732,7 +723,7 @@ class DataService
public static function repairSupplierChannel() public static function repairSupplierChannel()
{ {
SupplierChannelModel::where('supplier_id',272)->update([ SupplierChannelModel::where('supplier_id', 272)->update([
'is_entity' => -1, 'is_entity' => -1,
'status' => 2, 'status' => 2,
]); ]);
...@@ -789,4 +780,29 @@ class DataService ...@@ -789,4 +780,29 @@ class DataService
} }
} }
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 () ...@@ -90,5 +90,5 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function ()
}); });
Route::match(['get', 'post'], '/test', 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