|
|
|
@ -231,28 +231,48 @@ class Import extends ImportModel |
|
|
|
|
|
|
|
|
|
self::$storeId = $form['store_id'] ?? 0; |
|
|
|
|
foreach ($execlData as $key => $value) { |
|
|
|
|
|
|
|
|
|
$upData = [ |
|
|
|
|
'goods_name'=> $value['B'], |
|
|
|
|
'cmmdty_model'=> $value['C'], |
|
|
|
|
'goods_source'=> $value['D'], |
|
|
|
|
'goods_no'=> $value['E'], |
|
|
|
|
//'goods_no'=> $value['E'], |
|
|
|
|
'delivery_time'=> $value['G'], |
|
|
|
|
'is_check'=> $value['H'], |
|
|
|
|
'delivery_id'=> $value['I'], |
|
|
|
|
'status'=> $value['J'], |
|
|
|
|
'cost_price_min'=> $value['K'], |
|
|
|
|
'goods_price_min'=> $value['L'], |
|
|
|
|
'goods_price_max'=> $value['L'], |
|
|
|
|
'line_price_min'=> $value['L'], |
|
|
|
|
'line_price_max'=> $value['L'], |
|
|
|
|
// 'cost_price_min'=> $value['K'], |
|
|
|
|
// 'goods_price_min'=> $value['L'], |
|
|
|
|
// 'goods_price_max'=> $value['L'], |
|
|
|
|
// 'line_price_min'=> $value['L'], |
|
|
|
|
// 'line_price_max'=> $value['L'], |
|
|
|
|
'stock_total'=> $value['M'], |
|
|
|
|
'remark'=> $value['N'], |
|
|
|
|
]; |
|
|
|
|
$goods = GoodsModel::where('goods_id', $value['A'])->find(); |
|
|
|
|
if (!$goods) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
//自营数据才能更新价格 |
|
|
|
|
if (in_array($goods['channel'], ['zy'])) { |
|
|
|
|
$upData['goods_no'] = $value['E']; |
|
|
|
|
$upData['cost_price_min'] = $value['K']; |
|
|
|
|
$upData['goods_price_min' ]= $value['L']; |
|
|
|
|
$upData['goods_price_max'] = $value['L']; |
|
|
|
|
$upData['line_price_min'] = $value['L']; |
|
|
|
|
$upData['line_price_max'] = $value['L']; |
|
|
|
|
$profit = (float)$upData['goods_price_min'] - (float)$upData['cost_price_min']; |
|
|
|
|
$profit_rate = (float)$upData['goods_price_min'] > 0 ? bcmul(bcdiv((string)$profit, (string)$upData['goods_price_min'], 2), (string)100, 2) : 0.00; |
|
|
|
|
$upData['profit'] = $profit; |
|
|
|
|
$upData['profit_rate'] = $profit_rate; |
|
|
|
|
GoodsSkuModel::where('goods_id', $value['A'])->update(['cost_price' => $value['K'], 'goods_price' => $value['L']]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// echo "<pre>"; |
|
|
|
|
// print_r(explode(",", $value['F'])); |
|
|
|
|
// exit(); |
|
|
|
|
GoodsModel::where('goods_id', $value['A'])->update($upData); |
|
|
|
|
GoodsSkuModel::where('goods_id', $value['A'])->update(['cost_price' => $value['K'], 'goods_price' => $value['L']]); |
|
|
|
|
|
|
|
|
|
GoodsCategoryRelModel::updates((int)$value['A'], explode(",", $value['F'])); |
|
|
|
|
} |
|
|
|
|
return true; |
|
|
|
|