commit
05628300f9
@ -47,7 +47,7 @@ class BeforehandOrderLists extends BaseAdminDataLists implements ListsSearchInte
|
||||
public function lists(): array
|
||||
{
|
||||
return BeforehandOrder::where($this->searchWhere)
|
||||
->field(['id','order_id','store_id','order_type','total_num','total_price','outbound_id','admin_id','create_time', 'status', 'mark','warehousing_id'])
|
||||
->field(['id','order_id','store_id','order_type','total_num','total_price','outbound_id','admin_id','create_time', 'status', 'mark','warehousing_id','file'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function ($item){
|
||||
|
@ -27,6 +27,7 @@ use app\common\service\xlsx\OrderAllocation;
|
||||
use app\common\service\xlsx\OrderInfo;
|
||||
use app\common\service\xlsx\OrderList;
|
||||
use app\common\service\xlsx\OrderOutbound;
|
||||
use DateTime;
|
||||
use support\exception\BusinessException;
|
||||
use think\facade\Db;
|
||||
|
||||
@ -65,6 +66,7 @@ class BeforehandOrderLogic extends BaseLogic
|
||||
unset($params['product_arr'][$k]);
|
||||
continue;
|
||||
}
|
||||
$total_prices=bcmul($v['price'],$v['nums'],2);
|
||||
$datas[$k]['purchase'] = $v['purchase'];
|
||||
$datas[$k]['mark'] = $v['mark'] ?? '';
|
||||
$datas[$k]['product_id'] = $v['product_id'];
|
||||
@ -80,12 +82,12 @@ class BeforehandOrderLogic extends BaseLogic
|
||||
$datas[$k]['accept_num'] = $v['nums'];
|
||||
$datas[$k]['price'] = $v['price'];
|
||||
$datas[$k]['package'] = $v['package'] ?? '';
|
||||
$datas[$k]['total_price'] = $v['total_price'];
|
||||
$datas[$k]['pay_price'] = $v['total_price'];
|
||||
$datas[$k]['total_price'] =$total_prices;
|
||||
$datas[$k]['pay_price'] = $total_prices;
|
||||
$datas[$k]['create_time'] = time();
|
||||
$datas[$k]['update_time'] = time();
|
||||
$total_num += $v['nums'];
|
||||
$total_price += $v['total_price'];
|
||||
$total_price += $total_prices;
|
||||
}
|
||||
$order = BeforehandOrder::create([
|
||||
'order_id' => getNewOrderId('YG'),
|
||||
@ -102,12 +104,11 @@ class BeforehandOrderLogic extends BaseLogic
|
||||
'phone' => $params['phone'] ?? '',
|
||||
'address' => $params['address'] ?? '',
|
||||
'mark' => $params['mark'] ?? '',
|
||||
'arrival_time' => strtotime($params['arrival_time']),
|
||||
'order_type' => $order_type,
|
||||
'other_data' => json_encode($params['other_data'], true)
|
||||
]);
|
||||
/** 添加审批记录 */
|
||||
BeforehandOrderRecord::create(['oid'=>$order['id'],'step_id'=>1]);
|
||||
BeforehandOrderRecord::create(['oid' => $order['id'], 'step_id' => 1]);
|
||||
$product_arr = [];
|
||||
foreach ($datas as $k => $v) {
|
||||
$datas[$k]['bhoid'] = $order['id'];
|
||||
@ -308,23 +309,14 @@ class BeforehandOrderLogic extends BaseLogic
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
BeforehandOrder::where('id', $params['id'])->update([
|
||||
'store_id' => $params['store_id'],
|
||||
'order_id' => $params['order_id'],
|
||||
'uid' => $params['uid'],
|
||||
'cart_id' => $params['cart_id'],
|
||||
'total_num' => $params['total_num'],
|
||||
'total_price' => $params['total_price'],
|
||||
'pay_price' => $params['pay_price'],
|
||||
'deduction_price' => $params['deduction_price'],
|
||||
'paid' => $params['paid'],
|
||||
'pay_time' => $params['pay_time'],
|
||||
'pay_type' => $params['pay_type'],
|
||||
'source' => $params['source'],
|
||||
'status' => $params['status'],
|
||||
$find=BeforehandOrder::where('id', $params['id'])->find();
|
||||
$other_data=$find['other_data'];
|
||||
$other_data['arrival_time']=strtotime($params['arrival_time']);
|
||||
$find->update([
|
||||
'other_data'=>json_encode($other_data, true),
|
||||
'image' => $params['image'],
|
||||
'mark' => $params['mark']
|
||||
]);
|
||||
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Throwable $e) {
|
||||
@ -508,8 +500,7 @@ class BeforehandOrderLogic extends BaseLogic
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$res = BeforehandOrder::findOrEmpty($params['id'])->toArray();
|
||||
|
||||
$res = BeforehandOrder::where('id',$params['id'])->find()->toArray();
|
||||
$ids = BeforehandOrderCartInfo::where('bhoid', $params['id'])->column('product_id');
|
||||
$top_cate_ids = StoreProduct::where('id', 'in', $ids)->column('top_cate_id');
|
||||
if ($top_cate_ids) {
|
||||
@ -519,14 +510,13 @@ class BeforehandOrderLogic extends BaseLogic
|
||||
}
|
||||
$res['system_store'] = SystemStore::where('id', $res['store_id'])->value('name');
|
||||
$res['admin_name'] = Admin::where('id', $res['admin_id'])->value('name');
|
||||
$record=BeforehandOrderRecord::where('oid',$params['id'])->order('id','desc')->find();
|
||||
$res['step_id']=1;
|
||||
if($record){
|
||||
$res['step_id']=$record['step_id'];
|
||||
if($record['check_user_id']>0){
|
||||
$res['examine_name']=Admin::where('id',$record['check_user_id'])->value('name');
|
||||
$record = BeforehandOrderRecord::where('oid', $params['id'])->order('id', 'desc')->find();
|
||||
$res['step_id'] = 1;
|
||||
if ($record) {
|
||||
$res['step_id'] = $record['step_id'];
|
||||
if ($record['check_user_id'] > 0) {
|
||||
$res['examine_name'] = Admin::where('id', $record['check_user_id'])->value('name');
|
||||
}
|
||||
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
@ -568,6 +558,19 @@ class BeforehandOrderLogic extends BaseLogic
|
||||
});
|
||||
$other_data = $order['other_data'];
|
||||
unset($order['other_data']);
|
||||
$dateTime = new DateTime($order['create_time']);
|
||||
$hour = (int) $dateTime->format('H');
|
||||
// 判断时间是否小于18点
|
||||
if ($hour < 18) {
|
||||
// 时间小于18点的逻辑
|
||||
$order['storage_time'] = $dateTime->modify('+60 minutes')->format('Y-m-d H:i:s');
|
||||
$order['delivery_time'] = $dateTime->modify('+90 minutes')->format('Y-m-d H:i:s');
|
||||
} else {
|
||||
// 时间大于或等于18点的逻辑
|
||||
$order['storage_time'] = $dateTime->modify('+150 minutes')->format('Y-m-d H:i:s');
|
||||
$order['delivery_time'] = $dateTime->modify('+205 minutes')->format('Y-m-d H:i:s');
|
||||
}
|
||||
$order['split_time'] = $dateTime->modify('+10 minutes')->format('Y-m-d H:i:s');
|
||||
$file_path = $order_allocation->export($data, $order, $other_data);
|
||||
return $file_path;
|
||||
}
|
||||
@ -595,7 +598,7 @@ class BeforehandOrderLogic extends BaseLogic
|
||||
return $file_path;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* 导出出库
|
||||
*/
|
||||
public static function OrderOutbound($params)
|
||||
@ -609,7 +612,7 @@ class BeforehandOrderLogic extends BaseLogic
|
||||
$item['store_name'] = $find['store_name'];
|
||||
return $item;
|
||||
});
|
||||
$order['system_store_name']=SystemStore::where('id', $order['store_id'])->value('name');
|
||||
$order['system_store_name'] = SystemStore::where('id', $order['store_id'])->value('name');
|
||||
$other_data = $order['other_data'];
|
||||
unset($order['other_data']);
|
||||
$file_path = $order_info->export($data, $order, $other_data);
|
||||
|
@ -292,6 +292,13 @@ class StoreProductLogic extends BaseLogic
|
||||
if(empty($data)){
|
||||
throw new BusinessException('商品不存在');
|
||||
}
|
||||
$data['cate_arr']=[$data['top_cate_id']];
|
||||
if($data['two_cate_id'] == $data['top_cate_id']){
|
||||
$data['cate_arr'][]=$data['cate_id'];
|
||||
}else{
|
||||
$data['cate_arr'][]=$data['two_cate_id'];
|
||||
$data['cate_arr'][]=$data['cate_id'];
|
||||
}
|
||||
$data['unit_name']=StoreProductUnit::where('id', $data['unit'])->value('name');
|
||||
return $data;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ namespace app\admin\logic\warehouse_product_return;
|
||||
|
||||
use app\common\model\warehouse_product_return\WarehouseProductReturn;
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\beforehand_order\BeforehandOrder;
|
||||
use app\common\model\warehouse_product\WarehouseProduct;
|
||||
use app\common\model\warehouse_product_storege\WarehouseProductStorege;
|
||||
use support\exception\BusinessException;
|
||||
@ -33,8 +34,10 @@ class WarehouseProductReturnLogic extends BaseLogic
|
||||
try {
|
||||
$find=WarehouseProduct::where('id',$params['id'])->find();
|
||||
if($find){
|
||||
$id=BeforehandOrder::where('id',$find['oid'])->value('id');
|
||||
WarehouseProductReturn::create([
|
||||
'source_id'=>$params['id'],
|
||||
'bhoid'=>$id??0,
|
||||
'warehouse_id'=>$find['warehouse_id'],
|
||||
'supplier_id'=>$find['supplier_id'],
|
||||
'store_id'=>$find['store_id'],
|
||||
|
@ -55,7 +55,7 @@ class IndexController extends BaseApiController
|
||||
{
|
||||
d(1);
|
||||
|
||||
$arr=StoreOrder::where('store_id',8)->where('paid',1)->field('id,pay_price')->select()->toArray();
|
||||
$arr=StoreOrder::where('store_id',3)->where('paid',1)->field('id,pay_price,deduction_price,refund_price')->select()->toArray();
|
||||
$data=[];
|
||||
foreach ($arr as $k => $v) {
|
||||
$total_price=StoreOrderCartInfo::where('oid', $v['id'])->sum('total_price');
|
||||
|
@ -50,13 +50,13 @@ class OrderAllocation
|
||||
|
||||
$sheet->setCellValue('A4', '编号');
|
||||
$sheet->setCellValue('B4', '品名');
|
||||
$sheet->setCellValue('C4', '型号');
|
||||
$sheet->setCellValue('C4', '数量');
|
||||
$sheet->setCellValue('D4', '包装');
|
||||
$sheet->setCellValue('E4', '毛重');
|
||||
$sheet->setCellValue('F4', '净重(约)');
|
||||
$sheet->setCellValue('G4', '单位');
|
||||
$sheet->setCellValue('H4', '销售单价');
|
||||
$sheet->setCellValue('I4', '下单数量');
|
||||
$sheet->setCellValue('I4', '型号');
|
||||
$sheet->setCellValue('J4', '下单金额');
|
||||
$sheet->setCellValue('K4', '发货量');
|
||||
$sheet->setCellValue('L4', '实发量');
|
||||
@ -79,13 +79,13 @@ class OrderAllocation
|
||||
foreach ($data as $k => $v) {
|
||||
$sheet->setCellValue('A' . ($k + 5), $v['product_id']);
|
||||
$sheet->setCellValue('B' . ($k + 5), $v['store_name']);
|
||||
$sheet->setCellValue('C' . ($k + 5), $v['marques']);
|
||||
$sheet->setCellValue('C' . ($k + 5), $v['cart_num']);
|
||||
$sheet->setCellValue('D' . ($k + 5), $v['package']);
|
||||
$sheet->setCellValue('E' . ($k + 5), $v['gross_weight']);
|
||||
$sheet->setCellValue('F' . ($k + 5), $v['net_weight']);
|
||||
$sheet->setCellValue('G' . ($k + 5), $v['unit_name']);
|
||||
$sheet->setCellValue('H' . ($k + 5), $v['price']);
|
||||
$sheet->setCellValue('I' . ($k + 5), $v['cart_num']);
|
||||
$sheet->setCellValue('I' . ($k + 5), $v['marques']);
|
||||
$sheet->setCellValue('J' . ($k + 5), $v['total_price']);
|
||||
$sheet->setCellValue('K' . ($k + 5), $v['accept_num']);
|
||||
$sheet->setCellValue('L' . ($k + 5),$v['accept_num']);
|
||||
@ -128,19 +128,17 @@ class OrderAllocation
|
||||
$sheet->setCellValue('N' . ($count + 8),$other_data->regional_manager??'');
|
||||
|
||||
$sheet->setCellValue('A' . ($count + 9),'接单时间');
|
||||
$sheet->setCellValue('B' . ($count + 9),'');
|
||||
$sheet->setCellValue('B' . ($count + 9),$order['create_time']??'');
|
||||
$sheet->setCellValue('C' . ($count + 9),'分单时间');
|
||||
$sheet->setCellValue('D' . ($count + 9),'');
|
||||
$sheet->setCellValue('D' . ($count + 9),$order['split_time']??'');
|
||||
$sheet->setCellValue('E' . ($count + 9),'入库时间');
|
||||
$sheet->setCellValue('F' . ($count + 9),'');
|
||||
$sheet->setCellValue('G' . ($count + 9),' 出库时间');
|
||||
$sheet->setCellValue('H' . ($count + 9),'');
|
||||
$sheet->setCellValue('F' . ($count + 9),$order['storage_time']??'');
|
||||
$sheet->setCellValue('G' . ($count + 9),' 分拣时间');
|
||||
$sheet->setCellValue('H' . ($count + 9),$order['delivery_time']??'');
|
||||
$sheet->setCellValue('I' . ($count + 9),' 到门店时间');
|
||||
$sheet->setCellValue('J' . ($count + 9),'');
|
||||
$sheet->setCellValue('K' . ($count + 9),' 下单到货时间');
|
||||
$sheet->setCellValue('L' . ($count + 9),'');
|
||||
$sheet->setCellValue('M' . ($count + 9),' 实际到货时间');
|
||||
$sheet->setCellValue('N' . ($count + 9),'');
|
||||
// 设置单元格的样式
|
||||
$styleArray = [
|
||||
'font' => [
|
||||
|
@ -546,3 +546,18 @@ function channelLog($data, $type, $title = '更新前')
|
||||
$log = Log::channel($type);
|
||||
$log->info($title, $data);
|
||||
}
|
||||
|
||||
// if (!function_exists('getNewOrderSn')) {
|
||||
|
||||
// /**
|
||||
// * @notes 获取订单号
|
||||
// * @param $type
|
||||
// * @return string
|
||||
// */
|
||||
// function getNewOrderSn($type)
|
||||
// {
|
||||
// list($msec, $sec) = explode(' ', microtime());
|
||||
// $orderId = $type . date('YmdHis', time());
|
||||
// return $orderId;
|
||||
// }
|
||||
// }
|
Loading…
x
Reference in New Issue
Block a user