mirror of
https://gitee.com/hzchunfen/erp.git
synced 2025-12-01 14:40:44 +00:00
feat: #10000 拣货单优化
This commit is contained in:
parent
8f060c2da5
commit
ede8c851bd
@ -47,13 +47,13 @@ class Test extends Command
|
|||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
$shop = Shop::query()->find(1);
|
$shop = Shop::query()->find(3);
|
||||||
$business = BusinessFactory::init()->make($shop->plat_id);
|
$business = BusinessFactory::init()->make($shop->plat_id);
|
||||||
$business->setShop($shop);
|
$business->setShop($shop);
|
||||||
$order = BusinessOrder::query()->where('shop_id', 1)->where('participate_no', 6436)->first();
|
// $order = BusinessOrder::query()->where('shop_id', 1)->where('participate_no', 6436)->first();
|
||||||
// $res = $business->getOrderInfo($order->order_sn);
|
// $res = $business->getOrderInfo($order->order_sn);
|
||||||
$endTime = DateTimeUtils::getMicroTime();
|
$endTime = DateTimeUtils::getMicroTime('2023-04-04 19:27:27');
|
||||||
$beginTime = $endTime - 3000;
|
// $beginTime = $endTime - 3000;
|
||||||
$res = $business->getOrderInfo($beginTime, $endTime + 3000);
|
$beginTime = DateTimeUtils::getMicroTime('2023-04-04 19:15:29');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -38,27 +38,43 @@ class OrderBlankExport implements FromCollection, WithStyles
|
|||||||
$data = [
|
$data = [
|
||||||
['店铺名称', $this->shopName],
|
['店铺名称', $this->shopName],
|
||||||
['跟团号', $noStr],
|
['跟团号', $noStr],
|
||||||
['种类', '品牌', '商品规格', '商品名称', '数量', '所在货架编号', '配货'],
|
['种类', '品牌', '商品名称', '数量', '货架', '配货'],
|
||||||
];
|
];
|
||||||
$goodsCodes = array_column($excelDate, 'goods_code');
|
$goodsCodes = array_column($excelDate, 'goods_code');
|
||||||
$goods = Goods::query()
|
$goods = Goods::query()
|
||||||
->with([
|
->with([
|
||||||
'brand:id,name',
|
'brand:id,name',
|
||||||
'type:id,name',
|
'type:id,name',
|
||||||
|
'skus:id,goods_id,sku_code,title'
|
||||||
])
|
])
|
||||||
->whereIn('goods_code', $goodsCodes)
|
->whereIn('goods_code', $goodsCodes)
|
||||||
->get(['goods_code', 'type_id', 'brand_id'])
|
->get(['id', 'title', 'goods_code', 'type_id', 'brand_id'])
|
||||||
->toArray();
|
->toArray();
|
||||||
$goods = ArrayUtils::index($goods, 'goods_code');
|
$goods = ArrayUtils::index($goods, 'goods_code');
|
||||||
foreach ($excelDate as $key => $item) {
|
foreach ($excelDate as $key => $item) {
|
||||||
|
$str = '';
|
||||||
|
$num = 0;
|
||||||
|
foreach ($item['p'] as $k => $v) {
|
||||||
|
$str .= $v . ';';
|
||||||
|
$num++;
|
||||||
|
if (6 === $num) {
|
||||||
|
$str .= PHP_EOL;
|
||||||
|
$num = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
$goodsInfo = $goods[$item['goods_code']];
|
$goodsInfo = $goods[$item['goods_code']];
|
||||||
|
$name = '';
|
||||||
|
foreach ($goodsInfo['skus'] as $sku) {
|
||||||
|
if ($sku['sku_code'] === $item['sku_code']) {
|
||||||
|
$name = $goodsInfo['title'] . $sku['title'];
|
||||||
|
}
|
||||||
|
}
|
||||||
$arr[0] = $goodsInfo['type']['name'];
|
$arr[0] = $goodsInfo['type']['name'];
|
||||||
$arr[1] = $goodsInfo['brand']['name'];
|
$arr[1] = $goodsInfo['brand']['name'];
|
||||||
$arr[2] = $key;
|
$arr[2] = $name;
|
||||||
$arr[3] = $item['goods_name'];
|
$arr[3] = $item['num'];
|
||||||
$arr[4] = $item['num'];
|
$arr[4] = $item['local'];
|
||||||
$arr[5] = $item['local'];
|
$arr[5] = $str;
|
||||||
$arr[6] = implode(' ', $item['p']);
|
|
||||||
$data[] = $arr;
|
$data[] = $arr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,20 +83,18 @@ class OrderBlankExport implements FromCollection, WithStyles
|
|||||||
|
|
||||||
public function styles(Worksheet $sheet)
|
public function styles(Worksheet $sheet)
|
||||||
{
|
{
|
||||||
$count = $this->count + 2;
|
$count = $this->count + 3;
|
||||||
$sheet->mergeCells('B2:G2');
|
|
||||||
$sheet->getStyle('B2')->getAlignment()
|
$sheet->getStyle('B2')->getAlignment()
|
||||||
->setVertical('center')
|
|
||||||
->setWrapText(true);
|
->setWrapText(true);
|
||||||
$sheet->getStyle('G3:G' . $count)->getAlignment()
|
$sheet->mergeCells('B2:F2');
|
||||||
->setVertical('center')
|
$sheet->getStyle('F3:F' . $count)->getAlignment()
|
||||||
->setWrapText(true);
|
->setWrapText(true);
|
||||||
$sheet->getColumnDimension('A')->setWidth(10);
|
$sheet->getColumnDimension('A')->setWidth(8);
|
||||||
$sheet->getColumnDimension('B')->setWidth(10);
|
$sheet->getColumnDimension('B')->setWidth(10);
|
||||||
$sheet->getColumnDimension('C')->setWidth(10);
|
$sheet->getColumnDimension('C')->setWidth(36);
|
||||||
$sheet->getColumnDimension('D')->setWidth(60);
|
$sheet->getColumnDimension('D')->setWidth(5);
|
||||||
$sheet->getColumnDimension('E')->setWidth(5);
|
$sheet->getColumnDimension('E')->setWidth(5);
|
||||||
$sheet->getColumnDimension('F')->setWidth(11);
|
$sheet->getColumnDimension('F')->setWidth(36);
|
||||||
$sheet->getColumnDimension('G')->setWidth(14);
|
$sheet->getRowDimension(2)->setRowHeight(90);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -52,15 +52,16 @@ class BusinessOrderController extends Controller
|
|||||||
$distribution = [];
|
$distribution = [];
|
||||||
$no = [];
|
$no = [];
|
||||||
foreach ($orders as $key => $order) {
|
foreach ($orders as $key => $order) {
|
||||||
$no[] = $order->participate_no;
|
$index = $key + 1;
|
||||||
|
$no[] = 'P' . $index . '(' . $order->participate_no . ')';
|
||||||
foreach ($order->items as $item) {
|
foreach ($order->items as $item) {
|
||||||
$item = $item->toArray();
|
$item = $item->toArray();
|
||||||
if (empty($item['external_sku_id'])) {
|
if (empty($item['external_sku_id'])) {
|
||||||
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 . "({$order->participate_no}) * " . $item['goods_number'];
|
$index = "P{$index}*{$item['goods_number']}";
|
||||||
[$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;
|
||||||
@ -72,6 +73,7 @@ class BusinessOrderController extends Controller
|
|||||||
'num' => $item['goods_number'],
|
'num' => $item['goods_number'],
|
||||||
'goods_name' => $item['goods_name'],
|
'goods_name' => $item['goods_name'],
|
||||||
'goods_code' => $goodsCode,
|
'goods_code' => $goodsCode,
|
||||||
|
'sku_code' => $skuCode,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user