commit
a9b0f7e6c3
@ -37,7 +37,15 @@ class BeforehandOrderController extends BaseAdminController
|
|||||||
{
|
{
|
||||||
return $this->dataLists(new BeforehandOrderLists());
|
return $this->dataLists(new BeforehandOrderLists());
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 列表统计
|
||||||
|
*/
|
||||||
|
public function statistics_count()
|
||||||
|
{
|
||||||
|
$params=$this->request->get();
|
||||||
|
$data=BeforehandOrderLogic::statisticsCount($params);
|
||||||
|
return $this->data($data);
|
||||||
|
}
|
||||||
public function warehousing_lists()
|
public function warehousing_lists()
|
||||||
{
|
{
|
||||||
return $this->dataLists(new BeforehandOrderTwoLists());
|
return $this->dataLists(new BeforehandOrderTwoLists());
|
||||||
|
@ -391,6 +391,7 @@ class BeforehandOrderLogic extends BaseLogic
|
|||||||
'financial_pm' => 0,
|
'financial_pm' => 0,
|
||||||
'batch' => 0,
|
'batch' => 0,
|
||||||
'mark' => $mark,
|
'mark' => $mark,
|
||||||
|
'order_type' => $order['order_type'] ?? '',
|
||||||
];
|
];
|
||||||
$arr['delivery_time'] = strtotime($delivery_time);
|
$arr['delivery_time'] = strtotime($delivery_time);
|
||||||
$res = WarehouseOrder::create($arr);
|
$res = WarehouseOrder::create($arr);
|
||||||
@ -948,4 +949,56 @@ class BeforehandOrderLogic extends BaseLogic
|
|||||||
$model->save();
|
$model->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统计
|
||||||
|
*/
|
||||||
|
public static function statisticsCount($params)
|
||||||
|
{
|
||||||
|
$where = [];
|
||||||
|
if ($params['warehouse_type'] > 0) {
|
||||||
|
switch ($params['warehouse_type']) {
|
||||||
|
case 1:
|
||||||
|
$where[] = ['is_outbound', '=', 0];
|
||||||
|
$where[] = ['order_type', '<>', 5];
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
$where[] = ['is_outbound', '=', 1];
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
$where[] = ['is_warehousing', '=', 0];
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
$where[] = ['is_warehousing', '=', 1];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$orderCounts = BeforehandOrder::where('order_type', 'in', [1, 2, 3, 4, 5, 7, 8])
|
||||||
|
->group('order_type')
|
||||||
|
->where(['order_type', Db::raw('count(*) as count')])
|
||||||
|
->column('count', 'order_type');
|
||||||
|
d($orderCounts);
|
||||||
|
$order_type_1 = BeforehandOrder::where([['order_type', '=', 1]])->count();
|
||||||
|
$order_type_2 = BeforehandOrder::where([['order_type', '=', 2]])->count();
|
||||||
|
$order_type_3 = BeforehandOrder::where([['order_type', '=', 3]])->count();
|
||||||
|
$order_type_4 = BeforehandOrder::where([['order_type', '=', 4]])->count();
|
||||||
|
$order_type_5 = BeforehandOrder::where([['order_type', '=', 5]])->count();
|
||||||
|
$order_type_7 = BeforehandOrder::where([['order_type', '=', 7]])->count();
|
||||||
|
$order_type_8 = BeforehandOrder::where([['order_type', '=', 8]])->count();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$outbound_0 = BeforehandOrder::where([['is_outbound', '=', 0], ['order_type', '<>', 5]])->count();
|
||||||
|
$outbound_1 = BeforehandOrder::where([['is_outbound', '=', 1]])->count();
|
||||||
|
$warehousing_0 = BeforehandOrder::where([['is_warehousing', '=', 0]])->count();
|
||||||
|
$warehousing_1 = BeforehandOrder::where([['is_warehousing', '=', 1]])->count();
|
||||||
|
|
||||||
|
return [
|
||||||
|
'outbound_0' => $outbound_0,
|
||||||
|
'outbound_1' => $outbound_1,
|
||||||
|
'warehousing_0' => $warehousing_0,
|
||||||
|
'warehousing_1' => $warehousing_1,
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -180,6 +180,7 @@ class WarehouseProductLogic extends BaseLogic
|
|||||||
'unit' => $params['unit'] ?? 0,
|
'unit' => $params['unit'] ?? 0,
|
||||||
'status' => 1,
|
'status' => 1,
|
||||||
'mark' => $params['mark'] ?? '',
|
'mark' => $params['mark'] ?? '',
|
||||||
|
'order_type' => $params['order_type'] ?? '',
|
||||||
];
|
];
|
||||||
$res = WarehouseProduct::create($data);
|
$res = WarehouseProduct::create($data);
|
||||||
SqlChannelLog('WarehouseProduct', $res->id, $params['nums'], $params['financial_pm'] == 1 ? 1 : -1, Request()->url(),$admin_id);
|
SqlChannelLog('WarehouseProduct', $res->id, $params['nums'], $params['financial_pm'] == 1 ? 1 : -1, Request()->url(),$admin_id);
|
||||||
|
@ -71,12 +71,16 @@ class DemoLogic extends BaseLogic
|
|||||||
//活动价
|
//活动价
|
||||||
$find42 = StoreProductGroupPrice::where('product_id', $v['product_id'])->where('group_id', 42)->find();
|
$find42 = StoreProductGroupPrice::where('product_id', $v['product_id'])->where('group_id', 42)->find();
|
||||||
if ($find42) {
|
if ($find42) {
|
||||||
$find42->save(['price' => bcadd($v['price4'], 0, 2)]);
|
if($v['price9']>0){
|
||||||
|
$find42->save(['price' => bcadd($v['price9'], 0, 2)]);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if($v['price9']>0){
|
||||||
StoreProductGroupPrice::insert(['product_id' => $v['product_id'], 'group_id' => 42, 'price' => bcadd($v['price9'], 0, 2), 'price_type' => 3, 'base_rate' =>0]);
|
StoreProductGroupPrice::insert(['product_id' => $v['product_id'], 'group_id' => 42, 'price' => bcadd($v['price9'], 0, 2), 'price_type' => 3, 'base_rate' =>0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static function test2($store_id, $srr)
|
public static function test2($store_id, $srr)
|
||||||
{
|
{
|
||||||
|
@ -26,7 +26,6 @@ class UserLists extends BaseAdminDataLists implements ListsSearchInterface
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'=' => ['id','user_ship','store_id'],
|
'=' => ['id','user_ship','store_id'],
|
||||||
'%like%' => ['mobile'],
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,9 +49,12 @@ class UserLists extends BaseAdminDataLists implements ListsSearchInterface
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$query = User::where($this->searchWhere);
|
||||||
|
if (!empty($this->params['nickname'])) {
|
||||||
|
$query->whereLike('real_name|mobile', "%{$this->params['nickname']}%");
|
||||||
|
}
|
||||||
$field = "id,nickname,real_name,sex,avatar,account,mobile,now_money,user_ship,create_time,purchase_funds,integral";
|
$field = "id,nickname,real_name,sex,avatar,account,mobile,now_money,user_ship,create_time,purchase_funds,integral";
|
||||||
$lists = User::where($this->searchWhere)
|
$lists = $query->limit($this->limitOffset, $this->limitLength)
|
||||||
->limit($this->limitOffset, $this->limitLength)
|
|
||||||
->field($field)
|
->field($field)
|
||||||
->order('id desc')
|
->order('id desc')
|
||||||
->select()->each(function($data){
|
->select()->each(function($data){
|
||||||
|
@ -11,6 +11,7 @@ use app\common\model\store_order_cart_info\StoreOrderCartInfo;
|
|||||||
use app\common\model\store_product\StoreProduct;
|
use app\common\model\store_product\StoreProduct;
|
||||||
use app\common\model\store_product_price\StoreProductPrice;
|
use app\common\model\store_product_price\StoreProductPrice;
|
||||||
use app\common\model\user_recharge\UserRecharge;
|
use app\common\model\user_recharge\UserRecharge;
|
||||||
|
use app\common\model\warehouse_product\WarehouseProduct;
|
||||||
use support\Cache;
|
use support\Cache;
|
||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
use Webman\RedisQueue\Redis;
|
use Webman\RedisQueue\Redis;
|
||||||
@ -68,6 +69,7 @@ class Task
|
|||||||
|
|
||||||
$this->updateProductPrice();
|
$this->updateProductPrice();
|
||||||
$this->confirmProductPrice();
|
$this->confirmProductPrice();
|
||||||
|
$this->setPurchase();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -127,4 +129,31 @@ class Task
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置出库商品的供货价
|
||||||
|
* @return void
|
||||||
|
* @throws \think\db\exception\DataNotFoundException
|
||||||
|
* @throws \think\db\exception\DbException
|
||||||
|
* @throws \think\db\exception\ModelNotFoundException
|
||||||
|
*/
|
||||||
|
public function setPurchase()
|
||||||
|
{
|
||||||
|
$list = WarehouseProduct::where('purchase', 0)->order('id desc')->limit(100)->select()->toArray();
|
||||||
|
$productIds = array_unique(array_column($list, 'product_id'));
|
||||||
|
$products = StoreProduct::whereIn('id', $productIds)->field('id,purchase')->select()->toArray();
|
||||||
|
$products = reset_index($products, 'id');
|
||||||
|
$update = [];
|
||||||
|
foreach ($list as $item) {
|
||||||
|
$product = $products[$item['product_id']] ?? [];
|
||||||
|
if (empty($product) || empty($product['purchase'])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$update[] = [
|
||||||
|
'id' => $item['id'],
|
||||||
|
'purchase' => min($product['purchase'], $item['price']),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
(new WarehouseProduct())->saveAll($update);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user