mirror of
https://gitee.com/hzchunfen/erp.git
synced 2025-12-01 06:30:49 +00:00
commit
838e119de3
@ -43,6 +43,7 @@ class BusinessOrderController extends Controller
|
|||||||
->where('shop_id', $shopId)
|
->where('shop_id', $shopId)
|
||||||
->where('is_supplier', $isSupplier)
|
->where('is_supplier', $isSupplier)
|
||||||
->where($field, $startNo)
|
->where($field, $startNo)
|
||||||
|
->orderByDesc('id')
|
||||||
->value('confirm_at');
|
->value('confirm_at');
|
||||||
if (empty($startTime)) {
|
if (empty($startTime)) {
|
||||||
exit('开始跟团号订单未查询到或正在同步中,请稍后再次获取');
|
exit('开始跟团号订单未查询到或正在同步中,请稍后再次获取');
|
||||||
@ -52,6 +53,7 @@ class BusinessOrderController extends Controller
|
|||||||
->where('shop_id', $shopId)
|
->where('shop_id', $shopId)
|
||||||
->where('is_supplier', $isSupplier)
|
->where('is_supplier', $isSupplier)
|
||||||
->where($field, $endNo)
|
->where($field, $endNo)
|
||||||
|
->orderByDesc('id')
|
||||||
->value('confirm_at');
|
->value('confirm_at');
|
||||||
if (empty($endTime)) {
|
if (empty($endTime)) {
|
||||||
exit('结束跟团号订单未查询到或正在同步中,请稍后再次获取');
|
exit('结束跟团号订单未查询到或正在同步中,请稍后再次获取');
|
||||||
@ -62,7 +64,7 @@ class BusinessOrderController extends Controller
|
|||||||
}
|
}
|
||||||
$orders = BusinessOrder::query()
|
$orders = BusinessOrder::query()
|
||||||
->with([
|
->with([
|
||||||
'items:id,business_order_id,external_sku_id,goods_number,goods_name',
|
'items:id,business_order_id,external_sku_id,goods_number,goods_name,already_cancel_number',
|
||||||
'items.goodsSkuLocation:id,external_sku_id,location,goods_name'
|
'items.goodsSkuLocation:id,external_sku_id,location,goods_name'
|
||||||
])
|
])
|
||||||
->where('shop_id', $shopId)
|
->where('shop_id', $shopId)
|
||||||
@ -80,21 +82,22 @@ class BusinessOrderController extends Controller
|
|||||||
$no[] = 'P' . $index . '(' . $order->$field . ')';
|
$no[] = 'P' . $index . '(' . $order->$field . ')';
|
||||||
foreach ($order->items as $item) {
|
foreach ($order->items as $item) {
|
||||||
$item = $item->toArray();
|
$item = $item->toArray();
|
||||||
if (empty($item['external_sku_id'])) {
|
$num = $item['goods_number'] - $item['already_cancel_number'];
|
||||||
|
if (empty($item['external_sku_id']) || empty($num)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$local = $item['goods_sku_location'] ? $item['goods_sku_location']['location'] : '无';
|
$local = $item['goods_sku_location'] ? $item['goods_sku_location']['location'] : '无';
|
||||||
$index = $key + 1;
|
$index = $key + 1;
|
||||||
$index = "P{$index}*{$item['goods_number']}";
|
$index = "P{$index}*{$num}";
|
||||||
[$goodsCode, $skuCode] = explode('_', $item['external_sku_id']);
|
[$goodsCode, $skuCode] = explode('_', $item['external_sku_id']);
|
||||||
if (isset($distribution[$item['external_sku_id']])) {
|
if (isset($distribution[$item['external_sku_id']])) {
|
||||||
$distribution[$item['external_sku_id']]['p'][] = $index;
|
$distribution[$item['external_sku_id']]['p'][] = $index;
|
||||||
$distribution[$item['external_sku_id']]['num'] += $item['goods_number'];
|
$distribution[$item['external_sku_id']]['num'] += $num;
|
||||||
} else {
|
} else {
|
||||||
$distribution[$item['external_sku_id']] = [
|
$distribution[$item['external_sku_id']] = [
|
||||||
'p' => [$index],
|
'p' => [$index],
|
||||||
'local' => $local,
|
'local' => $local,
|
||||||
'num' => $item['goods_number'],
|
'num' => $num,
|
||||||
'goods_name' => $item['goods_name'],
|
'goods_name' => $item['goods_name'],
|
||||||
'goods_code' => $goodsCode,
|
'goods_code' => $goodsCode,
|
||||||
'sku_code' => $skuCode,
|
'sku_code' => $skuCode,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user