|
|
@@ -258,7 +258,6 @@ Class CommodityService
|
|
|
return Commodity::query()->create($params);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
public function syncBarcodes($barcodesStr, $ownerId, $sku): Commodity
|
|
|
{
|
|
|
$barcodes = (function () use ($barcodesStr) {
|
|
|
@@ -379,30 +378,6 @@ Class CommodityService
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- public function getCommoditiesByMap($map)
|
|
|
- {
|
|
|
- $collect = collect();
|
|
|
- if (count($map) == 0) return $collect;
|
|
|
- foreach ($map as $item) {
|
|
|
- $commodity = $this->getCommodityByOwnerCodeAndSKU($item['owner_code'], $item['sku']);
|
|
|
- $collect->push($commodity);
|
|
|
- }
|
|
|
- return $collect;
|
|
|
- }
|
|
|
-
|
|
|
- public function getCommodityByOwnerCodeAndSKU($ownerCode, $sku)
|
|
|
- {
|
|
|
- $commodity_key = "owner_code_{$ownerCode}_sku_{$sku}";
|
|
|
- return Cache::remember($commodity_key, config('cache.expirations.forever'), function () use ($ownerCode, $sku) {
|
|
|
- $commodity = Commodity::query()->where('sku', $sku)->where('owner_id', function ($query) use ($ownerCode) {
|
|
|
- $query->from('owners')->select('id')->where('code', $ownerCode);
|
|
|
- })->first();
|
|
|
- if (isset($commodity)) return $commodity;
|
|
|
- $basSKu = app('OracleBasSkuService')->first(['sku' => $sku, 'customerid' => $ownerCode]);
|
|
|
- return Commodity::query()->create($this->getParamsByBasSku($basSKu));
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
public function getParamsByBasSku($basSku, $owner = null)
|
|
|
{
|
|
|
if (empty($owner)) {
|