|
@@ -80,12 +80,7 @@ class SystemStoreStock extends BaseModel
|
|
|
if ($info['in_stock'] < $data['in_stock']) {
|
|
|
return self::setErrorInfo('库存不足');
|
|
|
}
|
|
|
- $add = bcsub($data['in_stock'], $info['repair_sales']);
|
|
|
- if ($add > 0) {
|
|
|
- self::where(['store_id' => $store_id, 'product_id' => $data['product_id'], 'bar_code' => $data['bar_code']])->update(['in_stock' => bcadd($info['in_stock'], $add), 'repair_sales' => 0]);
|
|
|
- } else {
|
|
|
- self::where(['store_id' => $store_id, 'product_id' => $data['product_id'], 'bar_code' => $data['bar_code']])->update(['repair_sales' => bcsub($info['repair_sales'], $data['in_stock'])]);
|
|
|
- }
|
|
|
+ self::where(['store_id' => $store_id, 'product_id' => $data['product_id'], 'bar_code' => $data['bar_code']])->update(['in_stock' => bcsub($info['in_stock'], $data['in_stock'])]);
|
|
|
@file_put_contents("stock.txt", self::getlastsql());
|
|
|
}
|
|
|
return true;
|