Commit 89db04b7 authored by wwccw0591's avatar wwccw0591

temp

parent 90cfdceb
......@@ -30,7 +30,10 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
$op = isset($this->setStorageType[$type]) ? $this->setStorageType[$type] : 2; //默认设置库存
$goodsDao->db->doTransaction();
$ret1 = $goodsDao->updateStorage($goodsId, $num, $op);
$ret2 = $commonDao->updateStorage($data['goods_commonid']);
$ret2 = true;
if($op==1) { //如果就库存调整
$ret2 = $commonDao->updateStorage($data['goods_commonid']);
}
if(!$ret1 || !$ret2) {
$goodsDao->db->doRollback();
......@@ -48,6 +51,7 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
$goodsDao=\DAO\GoodsModel::getInstance();
$where = array();
$where[] = 'store_id = '.$storeId;
$where[] = 'goods_storage_alarm > 0';
$where[] = 'goods_storage<=goods_storage_alarm';
//获得列表
if($datas = $goodsDao->getList(implode($where, ' and '), $this->goodsStorageField)) {
......
......@@ -39,10 +39,10 @@ class GoodsModel extends \DAO\AbstractModel {
public function updateStorage($goodsId, $num, $op) {
$this->setDb();
$whereSql = 'goods_id='.$goodsId;
if($op==1){
if($op==1){ //调整库存
$updateSql = 'goods_storage = goods_storage'.($num<0 ? '-'.(-$num) : '+'.$num);
} else {
$updateSql = 'goods_storage ='.$num;
} else { //调整库存预警为不需要预警
$updateSql = 'goods_storage_alarm =0';
}
$updateAllSql = "UPDATE {$this->_tableName} set {$updateSql} where {$whereSql}";
return $this->db->update($this->_tableName)->query($updateAllSql);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment