diff --git a/app/admin/controller/IndexController.php b/app/admin/controller/IndexController.php index be3c3f21e..a0182cb1e 100644 --- a/app/admin/controller/IndexController.php +++ b/app/admin/controller/IndexController.php @@ -33,7 +33,8 @@ class IndexController extends BaseAdminController public function demo3() { $id=$this->request->get('id'); - $res=DemoLogic::test3($id); + $warehouse_id=$this->request->get('warehouse_id',1); + $res=DemoLogic::test3($id,$warehouse_id); return $this->success('成功'); } } \ No newline at end of file diff --git a/app/admin/logic/beforehand_order_cart_info/BeforehandOrderCartInfoLogic.php b/app/admin/logic/beforehand_order_cart_info/BeforehandOrderCartInfoLogic.php index 128a9dc9e..89580cb29 100644 --- a/app/admin/logic/beforehand_order_cart_info/BeforehandOrderCartInfoLogic.php +++ b/app/admin/logic/beforehand_order_cart_info/BeforehandOrderCartInfoLogic.php @@ -351,7 +351,7 @@ class BeforehandOrderCartInfoLogic extends BaseLogic throw new BusinessException('请选择入库仓库'); } $purchaseProductOffer = PurchaseProductOffer::where('id', $params['id'])->find(); - if (empty($purchaseProductOffer) || $params['buyer_nums'] == 0) { + if (empty($purchaseProductOffer) || $params['warehouse_num'] == 0) { throw new BusinessException('请先设置采购信息再入库'); } if ($purchaseProductOffer['is_storage'] == 1) { @@ -389,7 +389,7 @@ class BeforehandOrderCartInfoLogic extends BaseLogic $warehouseOrder->total_price = bcadd($warehouseOrder->total_price, $purchaseProductOffer['total_price'], 2); $warehouseOrder->save(); } - $purchaseProductOffer['price'] = bcdiv($purchaseProductOffer['total_price'], $params['buyer_nums'], 2); + $purchaseProductOffer['price'] = bcdiv($purchaseProductOffer['total_price'], $params['warehouse_num'], 2); $data['admin_id'] = $params['admin_id']; $data['order_type'] = $beforehandOrder['order_type']; $data['store_id'] = 0; @@ -399,7 +399,7 @@ class BeforehandOrderCartInfoLogic extends BaseLogic $data['warehouse_id'] = $params['warehouse_id']; $data['code'] = $warehouseOrder['code']; $data['product_id'] = $purchaseProductOffer['product_id']; - $data['nums'] = $params['buyer_nums']; + $data['nums'] = $params['warehouse_num']; $data['purchase'] = $purchaseProductOffer['price']; $data['total_price'] = $purchaseProductOffer['total_price']; $data['financial_pm'] = 1; @@ -408,7 +408,7 @@ class BeforehandOrderCartInfoLogic extends BaseLogic if ($data['nums'] > 0) { WarehouseProductLogic::add($data, 1, $params['admin_id']); } - $offerUpdate = ['price' => $purchaseProductOffer['price'], 'status' => 1, 'is_storage' => 1, 'buyer_nums' => $params['buyer_nums']]; + $offerUpdate = ['price' => $purchaseProductOffer['price'], 'status' => 1, 'is_storage' => 1, 'warehouse_num' => $params['warehouse_num']]; $offerResult = PurchaseProductOffer::where('id', $purchaseProductOffer['id'])->where('is_storage', 0)->update($offerUpdate); if (!$offerResult) { throw new BusinessException('入库失败,采购信息更新出错'); diff --git a/app/admin/logic/purchase_product_offer/PurchaseProductOfferLogic.php b/app/admin/logic/purchase_product_offer/PurchaseProductOfferLogic.php index f318f5609..44a1ff631 100644 --- a/app/admin/logic/purchase_product_offer/PurchaseProductOfferLogic.php +++ b/app/admin/logic/purchase_product_offer/PurchaseProductOfferLogic.php @@ -222,7 +222,7 @@ class PurchaseProductOfferLogic extends BaseLogic Db::startTrans(); try { $offer->save([ - // 'buyer_nums' => $params['buyer_nums'], + 'buyer_nums' => $params['buyer_nums'], 'supplier_id' => $params['supplier_id'], // 'price' => $params['purchase'], // 'purchase_price' => $params['purchase_price'] ?? 0, diff --git a/app/common/service/xlsx/OrderAllocation.php b/app/common/service/xlsx/OrderAllocation.php index c50ab8dd0..b3f8098c1 100644 --- a/app/common/service/xlsx/OrderAllocation.php +++ b/app/common/service/xlsx/OrderAllocation.php @@ -50,21 +50,25 @@ class OrderAllocation $sheet->setCellValue('A4', '编号'); + $sheet->mergeCells('B4:E4'); $sheet->setCellValue('B4', '品名'); - $sheet->setCellValue('C4', '数量'); - $sheet->setCellValue('D4', '包装'); - $sheet->setCellValue('E4', '毛重'); - $sheet->setCellValue('F4', '净重(约)'); + $sheet->setCellValue('F4', '数量'); + // $sheet->setCellValue('D4', '包装'); + // $sheet->setCellValue('E4', '毛重'); + // $sheet->setCellValue('F4', '净重(约)'); $sheet->setCellValue('G4', '单位'); + $sheet->mergeCells('H4:I4'); $sheet->setCellValue('H4', '销售单价'); - $sheet->setCellValue('I4', '型号'); + // $sheet->setCellValue('I4', '型号'); $sheet->setCellValue('J4', '下单金额'); $sheet->setCellValue('K4', '发货量'); $sheet->setCellValue('L4', '实发量'); $sheet->setCellValue('M4', '结算金额'); - $sheet->setCellValue('N4', '售后'); - $sheet->setCellValue('O4', '正常损耗'); - $sheet->setCellValue('P4', '备注'); + $sheet->mergeCells('N4:P4'); + + // $sheet->setCellValue('N4', '售后'); + // $sheet->setCellValue('O4', '正常损耗'); + $sheet->setCellValue('N4', '备注'); // 设置默认的单元格样式 $defaultStyle = [ @@ -79,21 +83,24 @@ class OrderAllocation foreach ($data as $k => $v) { $sheet->setCellValue('A' . ($k + 5), $v['product_id']); + $sheet->mergeCells('B'. ($k + 5).':E'. ($k + 5)); $sheet->setCellValue('B' . ($k + 5), $v['store_name']); - $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('F' . ($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->mergeCells('H'. ($k + 5).':I'. ($k + 5)); $sheet->setCellValue('H' . ($k + 5), $v['price']); - $sheet->setCellValue('I' . ($k + 5), $v['marques']); + // $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']); $sheet->setCellValue('M' . ($k + 5),$v['pay_price']); - $sheet->setCellValue('N' . ($k + 5),$v['after_sales']); - $sheet->setCellValue('O' . ($k + 5),$v['loss']); - $sheet->setCellValue('P' . ($k + 5),$v['mark']); + // $sheet->setCellValue('N' . ($k + 5),$v['after_sales']); + // $sheet->setCellValue('O' . ($k + 5),$v['loss']); + $sheet->mergeCells('N'. ($k + 5).':P'. ($k + 5)); + $sheet->setCellValue('N' . ($k + 5),$v['mark']); } diff --git a/app/common/service/xlsx/OrderInfo.php b/app/common/service/xlsx/OrderInfo.php index aba991db4..17d8e849f 100644 --- a/app/common/service/xlsx/OrderInfo.php +++ b/app/common/service/xlsx/OrderInfo.php @@ -41,22 +41,25 @@ class OrderInfo $sheet->setCellValue('O2', $order['order_id']??''); $sheet->setCellValue('A3', '编号'); + $sheet->mergeCells('B3:D3'); $sheet->setCellValue('B3', '品名'); - $sheet->setCellValue('C3', '毛重'); - $sheet->setCellValue('D3', '净重(约)'); + // $sheet->setCellValue('C3', '毛重'); + // $sheet->setCellValue('D3', '净重(约)'); + $sheet->mergeCells('E3:F3'); $sheet->setCellValue('E3', '单位'); - $sheet->setCellValue('F3', '采购单价'); + // $sheet->setCellValue('F3', '采购单价'); $sheet->setCellValue('G3', '下单数量'); - $sheet->setCellValue('H3', '实收量'); - $sheet->setCellValue('I3', '采购金额'); - $sheet->setCellValue('J3', '结算模式'); - $sheet->setCellValue('K3', '包装'); - $sheet->setCellValue('L3', '押金'); - $sheet->setCellValue('M3', '型号'); - $sheet->setCellValue('N3', '售后'); - $sheet->setCellValue('O3', '损耗'); - $sheet->setCellValue('P3', '供应商'); - $sheet->setCellValue('Q3', '备注'); + // $sheet->setCellValue('H3', '实收量'); + // $sheet->setCellValue('I3', '采购金额'); + // $sheet->setCellValue('J3', '结算模式'); + // $sheet->setCellValue('K3', '包装'); + // $sheet->setCellValue('L3', '押金'); + // $sheet->setCellValue('M3', '型号'); + // $sheet->setCellValue('N3', '售后'); + // $sheet->setCellValue('O3', '损耗'); + // $sheet->setCellValue('P3', '供应商'); + $sheet->mergeCells('H3:Q3'); + $sheet->setCellValue('H3', '备注'); $sheet->setCellValue('R3', '采购人'); // 设置默认的单元格样式 @@ -72,22 +75,25 @@ class OrderInfo foreach ($data as $k => $v) { $sheet->setCellValue('A' . ($k + 4), $v['product_id']); + $sheet->mergeCells('B'. ($k + 4).':D'. ($k + 4)); $sheet->setCellValue('B' . ($k + 4), $v['store_name']); - $sheet->setCellValue('C' . ($k + 4), $v['gross_weight']); - $sheet->setCellValue('D' . ($k + 4), $v['net_weight']); + // $sheet->setCellValue('C' . ($k + 4), $v['gross_weight']); + // $sheet->setCellValue('D' . ($k + 4), $v['net_weight']); + $sheet->mergeCells('E'. ($k + 4).':F'. ($k + 4)); $sheet->setCellValue('E' . ($k + 4), $v['unit_name']); - $sheet->setCellValue('F' . ($k + 4), $v['price']); + // $sheet->setCellValue('F' . ($k + 4), $v['price']); $sheet->setCellValue('G' . ($k + 4), $v['need_num']); - $sheet->setCellValue('H' . ($k + 4), $v['buyer_nums']); - $sheet->setCellValue('I' . ($k + 4), $v['total_price']); - $sheet->setCellValue('J' . ($k + 4), ''); - $sheet->setCellValue('K' . ($k + 4), $v['package']); - $sheet->setCellValue('L' . ($k + 4), $v['deposit']); - $sheet->setCellValue('M' . ($k + 4), $v['marques']); - $sheet->setCellValue('N' . ($k + 4), $v['after_sales']); - $sheet->setCellValue('O' . ($k + 4), $v['loss']); - $sheet->setCellValue('P' . ($k + 4), ''); - $sheet->setCellValue('Q' . ($k + 4), $v['mark']); + $sheet->mergeCells('H'. ($k + 4).':Q'. ($k + 4)); + // $sheet->setCellValue('H' . ($k + 4), $v['buyer_nums']); + // $sheet->setCellValue('I' . ($k + 4), $v['total_price']); + // $sheet->setCellValue('J' . ($k + 4), ''); + // $sheet->setCellValue('K' . ($k + 4), $v['package']); + // $sheet->setCellValue('L' . ($k + 4), $v['deposit']); + // $sheet->setCellValue('M' . ($k + 4), $v['marques']); + // $sheet->setCellValue('N' . ($k + 4), $v['after_sales']); + // $sheet->setCellValue('O' . ($k + 4), $v['loss']); + // $sheet->setCellValue('P' . ($k + 4), ''); + $sheet->setCellValue('H' . ($k + 4), $v['mark']); $sheet->setCellValue('R' . ($k + 4), $v['buyer_name']); } diff --git a/app/common/service/xlsx/OrderOutbound.php b/app/common/service/xlsx/OrderOutbound.php index 912a6d8e0..18ecb3759 100644 --- a/app/common/service/xlsx/OrderOutbound.php +++ b/app/common/service/xlsx/OrderOutbound.php @@ -115,6 +115,26 @@ class OrderOutbound $sheet->setCellValue('F' . $count + 9, '电话:',); $sheet->setCellValue('G' . $count + 9, '08302669767',); $sheet->setCellValue('H' . $count + 9, '签收:',); + $sheet->mergeCells('A' . ($count + 10) . ':I' . ($count + 10)); + $sheet->setCellValue('A' . ($count + 10), '退货政策说明:'); + + $sheet->mergeCells('A' . ($count + 11) . ':I' . ($count + 11)); + $title3 = '1、冻货、生鲜、散装农产品等商品:由于此类商品是客户专项订购、无法重复销售,'; + $sheet->setCellValue('A' . ($count + 11), $title3); + + $sheet->mergeCells('A' . ($count + 12) . ':I' . ($count + 12)); + $title3 ='一旦出库,恕不退换货,请务必在购买前确认商品信息及需求。'; + $sheet->setCellValue('A' . ($count + 12), $title3); + + + $sheet->mergeCells('A' . ($count + 13) . ':I' . ($count + 13)); + $title4 = '2、其余商品:出库之日起10日内,退货数量不得超过该商品购买数量的30%'; + $sheet->setCellValue('A' . ($count + 13), $title4); + + $sheet->mergeCells('A' . ($count + 14) . ':I' . ($count + 14)); + $title4 = '上述要求旨在保障库存管理及商品周转的合理性。'; + $sheet->setCellValue('A' . ($count + 14), $title4); + // 设置单元格的样式 $styleArray = [ 'font' => [ @@ -132,7 +152,7 @@ class OrderOutbound ], ], ]; - $sheet->getStyle('A1:I' . ($count + 9))->applyFromArray($styleArray); + $sheet->getStyle('A1:I' . ($count + 14))->applyFromArray($styleArray); // 保存文件到 public 下 @@ -151,6 +171,9 @@ class OrderOutbound return getenv('APP_URL').$url; } + /** + * 无价格供货单 + */ public function exportWithoutPrice($data,$order,$other_data) { $title='供 投 里 海 农 特 产 品 出 库 供 货 单'; @@ -246,6 +269,26 @@ class OrderOutbound $sheet->setCellValue('F' . $count + 9, '电话:',); $sheet->setCellValue('G' . $count + 9, '08302669767',); $sheet->setCellValue('H' . $count + 9, '签收:',); + $sheet->mergeCells('A' . ($count + 10) . ':I' . ($count + 10)); + $sheet->setCellValue('A' . ($count + 10), '退货政策说明:'); + + $sheet->mergeCells('A' . ($count + 11) . ':I' . ($count + 11)); + $title3 = '1、冻货、生鲜、散装农产品等商品:由于此类商品是客户专项订购、无法重复销售,'; + $sheet->setCellValue('A' . ($count + 11), $title3); + + $sheet->mergeCells('A' . ($count + 12) . ':I' . ($count + 12)); + $title3 ='一旦出库,恕不退换货,请务必在购买前确认商品信息及需求。'; + $sheet->setCellValue('A' . ($count + 12), $title3); + + + $sheet->mergeCells('A' . ($count + 13) . ':I' . ($count + 13)); + $title4 = '2、其余商品:出库之日起10日内,退货数量不得超过该商品购买数量的30%'; + $sheet->setCellValue('A' . ($count + 13), $title4); + + $sheet->mergeCells('A' . ($count + 14) . ':I' . ($count + 14)); + $title4 = '上述要求旨在保障库存管理及商品周转的合理性。'; + $sheet->setCellValue('A' . ($count + 14), $title4); + // 设置单元格的样式 $styleArray = [ 'font' => [ @@ -263,7 +306,7 @@ class OrderOutbound ], ], ]; - $sheet->getStyle('A1:I' . ($count + 9))->applyFromArray($styleArray); + $sheet->getStyle('A1:I' . ($count + 14))->applyFromArray($styleArray); // 保存文件到 public 下 diff --git a/app/common/service/xlsx/OrderSupplyOutbound.php b/app/common/service/xlsx/OrderSupplyOutbound.php index 905b71a3f..1844a2d75 100644 --- a/app/common/service/xlsx/OrderSupplyOutbound.php +++ b/app/common/service/xlsx/OrderSupplyOutbound.php @@ -128,6 +128,25 @@ class OrderSupplyOutbound $sheet->setCellValue('F' . $count + 9, '电话:',); $sheet->setCellValue('G' . $count + 9, '08302669767',); $sheet->setCellValue('H' . $count + 9, '签收:',); + $sheet->mergeCells('A' . ($count + 10) . ':K' . ($count + 10)); + $sheet->setCellValue('A' . ($count + 10), '退货政策说明:'); + + $sheet->mergeCells('A' . ($count + 11) . ':K' . ($count + 11)); + $title3 = '1、冻货、生鲜、散装农产品等商品:由于此类商品是客户专项订购、无法重复销售,'; + $sheet->setCellValue('A' . ($count + 11), $title3); + + $sheet->mergeCells('A' . ($count + 12) . ':K' . ($count + 12)); + $title3 ='一旦出库,恕不退换货,请务必在购买前确认商品信息及需求。'; + $sheet->setCellValue('A' . ($count + 12), $title3); + + + $sheet->mergeCells('A' . ($count + 13) . ':K' . ($count + 13)); + $title4 = '2、其余商品:出库之日起10日内,退货数量不得超过该商品购买数量的30%'; + $sheet->setCellValue('A' . ($count + 13), $title4); + + $sheet->mergeCells('A' . ($count + 14) . ':K' . ($count + 14)); + $title4 = '上述要求旨在保障库存管理及商品周转的合理性。'; + $sheet->setCellValue('A' . ($count + 14), $title4); // 设置单元格的样式 $styleArray = [ 'font' => [ @@ -145,7 +164,7 @@ class OrderSupplyOutbound ], ], ]; - $sheet->getStyle('A1:K' . ($count + 9))->applyFromArray($styleArray); + $sheet->getStyle('A1:K' . ($count + 14))->applyFromArray($styleArray); // 保存文件到 public 下