京东打印

This commit is contained in:
杨建炊 2025-01-25 15:30:10 +08:00
parent 67271b4461
commit 8cb668e4b6
3 changed files with 21 additions and 8 deletions

View File

@ -24,7 +24,6 @@ class BusinessOrderController extends Controller
public function index(Request $request)
{
$shopIds = Shop::query()
->where('plat_id', Shop::$PLAT_KTT)
->pluck('id');
$builder = BusinessOrder::query()
->with([
@ -64,6 +63,7 @@ class BusinessOrderController extends Controller
return Excel::download(new BusinessOrderExport($builder->get()->toArray()), $startDate . '~' . $endDate . "订单数据" . '.xlsx');
}
$businessOrders = $builder->orderByDesc('confirm_at')
->paginate($request->get('per_page'));
@ -179,12 +179,8 @@ class BusinessOrderController extends Controller
public function print(Request $request)
{
$shopIds = Shop::query()
->where('plat_id', Shop::$PLAT_KTT)
->pluck('id');
$builder = BusinessOrder::query()
->with('items')
->whereIn('shop_id', $shopIds)
->filter();
$externalSkuIds = $request->get('external_sku_ids');

View File

@ -6,9 +6,12 @@ use App\Models\BusinessGoodsSku;
use App\Models\BusinessOrderItem;
use App\Models\GoodsSku;
use App\Services\Business\BusinessClient;
use Carbon\Carbon;
use Illuminate\Support\Facades\Log;
class MiaoXuan extends BusinessClient
{
public $domain = "http://shop.dev.chutang66.com";
public function auth()
{
@ -54,7 +57,7 @@ class MiaoXuan extends BusinessClient
$order->cancel_status = $queryOrder['cancel_status'];
$needUpdate = true;
}
if ($order->after_sales_status!= $queryOrder['after_sales_status']) {
if ($order->after_sales_status != $queryOrder['after_sales_status']) {
//售后状态更新
$order->after_sales_status = $queryOrder['after_sales_status'];
$needUpdate = true;
@ -100,7 +103,19 @@ class MiaoXuan extends BusinessClient
public function createLogistic($orderSn, $waybillNo)
{
// TODO: Implement createLogistic() method.
$path = "/miaoxuan/ship";
$url = $this->domain . $path;
$appendParams = [
"data" => [
"order_sn" => $orderSn,
"ship_sn" => $waybillNo,
"ship_time" => Carbon::now()->toDateTimeString(),
"company_code" => "JD",
],
"type"=>"miaoxuan.ship"
];
$res =$this->formDataPostRequest($url, $appendParams);
Log::info("同步物流发货信息".$orderSn,[$res,$appendParams]);
}
public function cancelLogistic($orderSn, $waybillNo)

View File

@ -5,6 +5,7 @@ namespace App\Services\WayBill\JingDong;
use App\Events\CreateLogisticEvent;
use App\Http\Enum\BusinessOrderShippingStatus;
use App\Models\BusinessOrder;
use App\Models\BusinessOrderItem;
use App\Models\GoodsSku;
use App\Models\ShopSender;
use App\Models\ShopShip;
@ -46,6 +47,7 @@ class WayBillService
$waybill->status = Waybill::$STATUS_CREATE_WAYBILL_CODE;
$waybill->waybill_code = $resp['waybillNo'];
$waybill->save();
//物流发货
event(new CreateLogisticEvent($waybill->shop_id, $waybill->order_sn, $waybill->waybill_code));
}
@ -126,7 +128,7 @@ class WayBillService
$waybill->wp_code = $senderConfig['wp_code'];
$waybill->order_sn = $order['order_sn'];
$waybill->order_id = $order['id'];
$waybill->participate_no = $order['participate_no'];
$waybill->participate_no = $order['participate_no'] ?? 0;
$waybill->note = $order['note'];
$waybill->items = json_encode($order['items'], 256);
$waybill->save();