commit
a32b98ae85
@ -52,6 +52,8 @@ class StoreOrderCartInfoGroupLists extends BaseAdminDataLists implements ListsSe
|
|||||||
if($this->request->get('start_time')==''){
|
if($this->request->get('start_time')==''){
|
||||||
$this->searchWhere[]=['create_time','between',[strtotime(date('Y-m-d 00:00:00')),strtotime(date('Y-m-d 23:59:59'))]];
|
$this->searchWhere[]=['create_time','between',[strtotime(date('Y-m-d 00:00:00')),strtotime(date('Y-m-d 23:59:59'))]];
|
||||||
}
|
}
|
||||||
|
$this->searchWhere[]=['is_pay','=',1];
|
||||||
|
$this->searchWhere[]=['status','>=',0];
|
||||||
return StoreOrderCartInfo::where($this->searchWhere)
|
return StoreOrderCartInfo::where($this->searchWhere)
|
||||||
->field('product_id,price,SUM(total_price) as total_price,SUM(cart_num) as cart_num')->group('product_id')
|
->field('product_id,price,SUM(total_price) as total_price,SUM(cart_num) as cart_num')->group('product_id')
|
||||||
->limit($this->limitOffset, $this->limitLength)
|
->limit($this->limitOffset, $this->limitLength)
|
||||||
|
@ -52,6 +52,8 @@ class StoreOrderCartInfoTwoLists extends BaseAdminDataLists implements ListsSear
|
|||||||
if ($this->request->get('start_time') == '') {
|
if ($this->request->get('start_time') == '') {
|
||||||
$this->searchWhere[] = ['create_time', 'between', [strtotime(date('Y-m-d 00:00:00')), strtotime(date('Y-m-d 23:59:59'))]];
|
$this->searchWhere[] = ['create_time', 'between', [strtotime(date('Y-m-d 00:00:00')), strtotime(date('Y-m-d 23:59:59'))]];
|
||||||
}
|
}
|
||||||
|
$this->searchWhere[]=['is_pay','=',1];
|
||||||
|
$this->searchWhere[]=['status','>=',0];
|
||||||
$query = StoreOrderCartInfo::where($this->searchWhere);
|
$query = StoreOrderCartInfo::where($this->searchWhere);
|
||||||
if ($this->request->get('is_group') == 1) {
|
if ($this->request->get('is_group') == 1) {
|
||||||
$query->field('store_id,product_id,price,SUM(total_price) as total_price,SUM(cart_num) as cart_num')->group(['store_id', 'product_id']);
|
$query->field('store_id,product_id,price,SUM(total_price) as total_price,SUM(cart_num) as cart_num')->group(['store_id', 'product_id']);
|
||||||
|
@ -314,7 +314,7 @@ class TradeStatisticLogic extends BaseLogic
|
|||||||
$depositWehre['financial_type'] = 11;
|
$depositWehre['financial_type'] = 11;
|
||||||
$orderDepositMoney = $this->getFinanceFlow($depositWehre, "sum");
|
$orderDepositMoney = $this->getFinanceFlow($depositWehre, "sum");
|
||||||
$lastOrderDepositMoney = $this->getFinanceFlow($dateWhere, "sum", "", $isNum);
|
$lastOrderDepositMoney = $this->getFinanceFlow($dateWhere, "sum", "", $isNum);
|
||||||
$OrderDepositCurve = $this->getFinanceFlow($where, "group", "create_time");
|
$OrderDepositCurve = $this->getFinanceFlow($depositWehre, "group", "create_time");
|
||||||
$OrderDepositChain = countRate($orderDepositMoney, $lastOrderDepositMoney);
|
$OrderDepositChain = countRate($orderDepositMoney, $lastOrderDepositMoney);
|
||||||
|
|
||||||
$topData[8] = [
|
$topData[8] = [
|
||||||
@ -483,17 +483,17 @@ class TradeStatisticLogic extends BaseLogic
|
|||||||
$orderGroup = "create_time";
|
$orderGroup = "create_time";
|
||||||
$OrderMoney = $this->getOrderTotalMoney($where, $selectType, $orderGroup);
|
$OrderMoney = $this->getOrderTotalMoney($where, $selectType, $orderGroup);
|
||||||
//用户充值收入
|
//用户充值收入
|
||||||
$rechargeGroup = "create_time";
|
// $rechargeGroup = "create_time";
|
||||||
$RechargeMoneyHome = $this->getRechargeTotalMoney($where, $selectType, $rechargeGroup);
|
// $RechargeMoneyHome = $this->getRechargeTotalMoney($where, $selectType, $rechargeGroup);
|
||||||
$RechargeMoneyAdmin = $this->getBillYeTotalMoney($where, $selectType, $rechargeGroup);
|
// $RechargeMoneyAdmin = $this->getBillYeTotalMoney($where, $selectType, $rechargeGroup);
|
||||||
$RechargeMoney = $this->totalArrData([$RechargeMoneyHome, $RechargeMoneyAdmin]);
|
// $RechargeMoney = $this->totalArrData([$RechargeMoneyHome, $RechargeMoneyAdmin]);
|
||||||
//购买会员收入
|
//购买会员收入
|
||||||
$memberGroup = "create_time";
|
// $memberGroup = "create_time";
|
||||||
$MemberMoney = $this->getMemberTotalMoney($where, $selectType, $memberGroup);
|
// $MemberMoney = $this->getMemberTotalMoney($where, $selectType, $memberGroup);
|
||||||
//线下收款收入
|
//线下收款收入
|
||||||
$offlineGroup = "create_time";
|
$offlineGroup = "create_time";
|
||||||
$OfflineMoney = $this->getOfflineTotalMoney($where, $selectType, $offlineGroup);
|
$OfflineMoney = $this->getOfflineTotalMoney($where, $selectType, $offlineGroup);
|
||||||
return $this->totalArrData([$OrderMoney, $RechargeMoney, $MemberMoney, $OfflineMoney]);
|
return $this->totalArrData([$OrderMoney, $OfflineMoney]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -8,6 +8,8 @@ use app\common\model\store_branch_product_attr_value\StoreBranchProductAttrValue
|
|||||||
use app\common\model\system_store_storage\SystemStoreStorage;
|
use app\common\model\system_store_storage\SystemStoreStorage;
|
||||||
use app\common\logic\BaseLogic;
|
use app\common\logic\BaseLogic;
|
||||||
use app\common\model\store_product\StoreProduct;
|
use app\common\model\store_product\StoreProduct;
|
||||||
|
use app\common\model\warehouse_product\WarehouseProduct;
|
||||||
|
use app\common\model\warehouse_product_storege\WarehouseProductStorege;
|
||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
|
|
||||||
|
|
||||||
@ -59,11 +61,12 @@ class SystemStoreStorageLogic extends BaseLogic
|
|||||||
*/
|
*/
|
||||||
public static function edit(array $params): bool
|
public static function edit(array $params): bool
|
||||||
{
|
{
|
||||||
$stock=StoreProduct::where('id', $params['product_id'])->value('stock');
|
$find=SystemStoreStorage::where('id', $params['id'])->find();
|
||||||
$nums=SystemStoreStorage::where('id', $params['id'])->value('nums');
|
|
||||||
$stock=bcadd($stock,$nums);
|
//查看仓库库存
|
||||||
if($stock<$params['nums']){
|
$productStorege=WarehouseProductStorege::where('product_id', $params['product_id'],['warehouse_id'=>$find['warehouse_id']])->find();
|
||||||
self::setError('库存不足,主库为:'.$stock);
|
if($productStorege && $productStorege['nums']<$params['nums']){
|
||||||
|
self::setError('库存不足,仓库库存为:'.$productStorege['nums']);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
@ -71,8 +74,12 @@ class SystemStoreStorageLogic extends BaseLogic
|
|||||||
SystemStoreStorage::where('id', $params['id'])->update([
|
SystemStoreStorage::where('id', $params['id'])->update([
|
||||||
'nums' => $params['nums'],
|
'nums' => $params['nums'],
|
||||||
'admin_id' => $params['admin_id'],
|
'admin_id' => $params['admin_id'],
|
||||||
|
'status' => 0,
|
||||||
|
'mark' => '',
|
||||||
]);
|
]);
|
||||||
StoreProduct::where('id', $params['product_id'])->update(['stock'=>bcsub($stock,$params['nums'])]);
|
StoreProduct::where('id', $params['product_id'])->inc('stock',bcsub($find['nums'] ,$params['nums'],2))->update();
|
||||||
|
WarehouseProductStorege::where('id',$productStorege['id'])->inc('stock',bcsub($find['nums'] ,$params['nums'],2))->update();
|
||||||
|
WarehouseProduct::where('id',$find['outbound_id'])->update(['nums',$params['nums']]);
|
||||||
Db::commit();
|
Db::commit();
|
||||||
return true;
|
return true;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
@ -90,10 +90,10 @@ class WarehouseProductLogic extends BaseLogic
|
|||||||
if(isset($params['expiration_date']) &&$params['expiration_date']!=''){
|
if(isset($params['expiration_date']) &&$params['expiration_date']!=''){
|
||||||
$data['expiration_date']=strtotime($params['expiration_date']);
|
$data['expiration_date']=strtotime($params['expiration_date']);
|
||||||
}
|
}
|
||||||
WarehouseProduct::where('id', $params['id'])->update($data);
|
$res=WarehouseProduct::where('id', $params['id'])->update($data);
|
||||||
|
|
||||||
Db::commit();
|
Db::commit();
|
||||||
return true;
|
return $res;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Db::rollback();
|
Db::rollback();
|
||||||
self::setError($e->getMessage());
|
self::setError($e->getMessage());
|
||||||
|
@ -563,6 +563,7 @@ class PayNotifyLogic extends BaseLogic
|
|||||||
*/
|
*/
|
||||||
public static function afterPay($order, $transaction_id = 0)
|
public static function afterPay($order, $transaction_id = 0)
|
||||||
{
|
{
|
||||||
|
StoreOrderCartInfo::where('oid', $order['id'])->update(['is_pay' => 1]);
|
||||||
$financeLogic = new StoreFinanceFlowLogic();
|
$financeLogic = new StoreFinanceFlowLogic();
|
||||||
$off_activity = Config::where('name', 'off_activity')->value('value');
|
$off_activity = Config::where('name', 'off_activity')->value('value');
|
||||||
$village_uid = 0;
|
$village_uid = 0;
|
||||||
|
@ -169,6 +169,7 @@ class StoreStorageSend implements Consumer
|
|||||||
'nums' => $product_arr['stock'],
|
'nums' => $product_arr['stock'],
|
||||||
'admin_id' => $admin_id,
|
'admin_id' => $admin_id,
|
||||||
'type' => $stock_type,
|
'type' => $stock_type,
|
||||||
|
'warehouse_id'=>$warehouse_id,
|
||||||
];
|
];
|
||||||
$data=[
|
$data=[
|
||||||
'warehouse_id'=>$warehouse_id,
|
'warehouse_id'=>$warehouse_id,
|
||||||
@ -187,11 +188,13 @@ class StoreStorageSend implements Consumer
|
|||||||
$storage['mark'] = '库存不足,分库存为:' .$warehouse['nums'];
|
$storage['mark'] = '库存不足,分库存为:' .$warehouse['nums'];
|
||||||
$data['mark'] = '库存不足,分库存为:' .$warehouse['nums'].' 总仓库存为:'.$find['stock'];
|
$data['mark'] = '库存不足,分库存为:' .$warehouse['nums'].' 总仓库存为:'.$find['stock'];
|
||||||
}
|
}
|
||||||
|
$res=WarehouseProductLogic::add($data);
|
||||||
|
$storage['outbound_id']=$res['id']??0;
|
||||||
SystemStoreStorage::create($storage);
|
SystemStoreStorage::create($storage);
|
||||||
WarehouseProductLogic::add($data);
|
|
||||||
} else {
|
} else {
|
||||||
|
$res=WarehouseProductLogic::add($data);
|
||||||
|
$storage['outbound_id']=$res['id']??0;
|
||||||
SystemStoreStorage::create($storage);
|
SystemStoreStorage::create($storage);
|
||||||
WarehouseProductLogic::add($data);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user