|
|
@@ -52,16 +52,7 @@ class ItemService extends BaseService
|
|
|
}
|
|
|
$name = $data['name'] ?? '';
|
|
|
|
|
|
- if ($price > 5) {
|
|
|
- $cost = bcsub($price, 5, 2);
|
|
|
- $addPrice = 5;
|
|
|
- } else {
|
|
|
- $cost = bcdiv($price, 2, 2);
|
|
|
- $addPrice = bcsub($price, $cost, 2);
|
|
|
- }
|
|
|
-
|
|
|
- $data['cost'] = $cost;
|
|
|
- $data['addPrice'] = $addPrice;
|
|
|
+ $data['cost'] = $price;
|
|
|
|
|
|
$stockWarning = isset($data['stockWarning']) && preg_match("/^[1-9][0-9]*$/", $data['stockWarning']) ? $data['stockWarning'] : 5;
|
|
|
|
|
|
@@ -86,17 +77,19 @@ class ItemService extends BaseService
|
|
|
$data['smallUnit'] = $ptItem['smallUnit'];
|
|
|
$data['variety'] = $ptItem['variety'] ?? 0;
|
|
|
$data['stockWarning'] = $stockWarning;
|
|
|
+ $data['addPrice'] = $ptItem['addPrice'] ?? 0;
|
|
|
+ $data['qtAddPrice'] = $ptItem['qtAddPrice'] ?? 0;
|
|
|
+ $data['byAddPrice'] = $ptItem['byAddPrice'] ?? 0;
|
|
|
+ $data['hjAddPrice'] = $ptItem['hjAddPrice'] ?? 0;
|
|
|
+ $data['zsAddPrice'] = $ptItem['zsAddPrice'] ?? 0;
|
|
|
|
|
|
- //写入一条item,同时写入一条itemInfo(初始化库存)
|
|
|
ItemClass::add($data);
|
|
|
- //根据sjId ,获取所有的shopId, 循环写入product
|
|
|
$shopIds = ShopService::getShopIds($sjId);
|
|
|
if (empty($shopIds)) {
|
|
|
util::fail("没有找到门店");
|
|
|
}
|
|
|
foreach ($shopIds as $shopId) {
|
|
|
$data['shopId'] = $shopId;
|
|
|
- //判断product 是否存在,若存在,则不再处理
|
|
|
$existItem = ProductClass::exists(['itemId' => $itemId, 'sjId' => $sjId, 'shopId' => $shopId]);
|
|
|
if ($existItem) {
|
|
|
continue;
|
|
|
@@ -251,7 +244,7 @@ class ItemService extends BaseService
|
|
|
$productData['itemId'] = $currentItem['id'];
|
|
|
$productData['classId'] = $ghsClassId;
|
|
|
unset($productData['id']);
|
|
|
- $productData['rank'] = 'A';
|
|
|
+ $productData['rank'] = 'B';
|
|
|
$productData['price'] = bcadd($currentItem['cost'], $currentItem['addPrice'], 2);
|
|
|
$productAddData[] = $productData;
|
|
|
|