更新导入

This commit is contained in:
shengchanzhe 2023-12-16 10:48:11 +08:00
parent 63edd3a80c
commit 67c084ab2c
2 changed files with 10 additions and 5 deletions

View File

@ -2680,7 +2680,7 @@ class StoreOrderRepository extends BaseRepository
"ot_price" => $datum['value']['price'],
"svip_price" => null,
"procure_price" => $procure_price,
"stock" => 1,
"stock" =>$datum['value']['stock']??1,
"bar_code" => (int)$datum['value']['bar_code'],
"weight" => 0,
"volume" => 0,
@ -2736,7 +2736,8 @@ class StoreOrderRepository extends BaseRepository
if (!empty($datum['value']['procure_price'])) {
$procure_price = $datum['value']['procure_price'];
}
$attrValue['stock'] = 1;
$stock=$datum['value']['stock']??1;
$attrValue['stock'] = $stock;
$unique = app(ProductRepository::class)->setUnique($find['product_id'], $datum['value']['bar_code'], $product_type);
$attrValue['unique'] = $unique;
$attrValue['detail'] = json_encode($attr_values);
@ -2748,7 +2749,7 @@ class StoreOrderRepository extends BaseRepository
$attrValue['price'] = $datum['value']['price'];
$attrValue['procure_price'] = $procure_price;
$attrValue["image"] = "https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/luzhou/static4/oa_app/23565656.png";
Db::name('store_product')->where('product_id',$find['product_id'])->update(['spec_type'=>1]);
Db::name('store_product')->where('product_id',$find['product_id'])->update(['spec_type'=>1,'stock'=>Db::raw('stock+'.$stock)]);
Db::name('store_product_attr_value')->insert($attrValue);
}
/**

View File

@ -222,6 +222,7 @@ class StoreImport extends BaseController
'K1'=>'成本价',
'L1'=>'商品条码',
'M1'=>'商品品牌',
'N1'=>'库存',
];
$a=SpreadsheetExcelService::instance()->checkImport($path,$check,true);
@ -230,7 +231,9 @@ class StoreImport extends BaseController
'data' => [
'path' => $path,
'sql' => ['store_name' => 'A', 'cate_id_one' => 'B', 'cate_id_two' => 'C', 'cate_id_one_mer' => 'D', 'cate_id_one_two' => 'E',
'attr_one' => 'F', 'attr_two' => 'G', 'unit_name' => 'H', 'procure_price' => 'I','price'=>'J','cost'=>'K','bar_code'=>'L','brand_id'=>'M'],
'attr_one' => 'F', 'attr_two' => 'G', 'unit_name' => 'H', 'procure_price' => 'I','price'=>'J','cost'=>'K','bar_code'=>'L','brand_id'=>'M'
,'stock'=>'N',
],
'where' => ['store_name' => 'A'],
]
];
@ -251,6 +254,7 @@ class StoreImport extends BaseController
'J1'=>'成本价',
'K1'=>'商品条码',
'L1'=>'商品品牌',
'M1'=>'库存',
];
SpreadsheetExcelService::instance()->checkImport($path,$check,true);
$data = [
@ -258,7 +262,7 @@ class StoreImport extends BaseController
'data' => [
'path' => $path,
'sql' => ['store_name' => 'A', 'cate_id_one' => 'B', 'cate_id_two' => 'C', 'cate_id_one_mer' => 'D', 'cate_id_one_two' => 'E',
'attr_one' => 'F', 'attr_two' => 'G', 'unit_name' => 'H', 'price' => 'I','cost'=>'J','bar_code'=>'K','brand_id'=>'L'],
'attr_one' => 'F', 'attr_two' => 'G', 'unit_name' => 'H', 'price' => 'I','cost'=>'J','bar_code'=>'K','brand_id'=>'L','stock'=>'M'],
'where' => ['store_name' => 'A'],
]
];