diff --git a/app/admin/controller/warehouse_order/WarehouseOrderController.php b/app/admin/controller/warehouse_order/WarehouseOrderController.php index fa7470f0..7c20b1dc 100644 --- a/app/admin/controller/warehouse_order/WarehouseOrderController.php +++ b/app/admin/controller/warehouse_order/WarehouseOrderController.php @@ -13,6 +13,7 @@ use app\common\model\store_branch_product\StoreBranchProduct; use app\common\model\store_order\StoreOrder; use app\common\model\store_product\StoreProduct; use app\common\model\store_product_unit\StoreProductUnit; +use app\common\model\supplier\Supplier; use app\common\model\system_store\SystemStore; use app\common\model\warehouse_order\WarehouseOrder; use app\common\model\warehouse_product\WarehouseProduct; @@ -209,6 +210,7 @@ class WarehouseOrderController extends BaseAdminController $value->unit_name = ''; } $order['total_num'] += $value->nums; + $value->supplier_name= Supplier::where('id', $value->supplier_id)->value('mer_name'); } $file_path = $xlsx->export($data, $order); @@ -222,6 +224,9 @@ class WarehouseOrderController extends BaseAdminController { $id = $this->request->post('id'); $type = $this->request->post('type'); + if(in_array($type, [2,3])){ + return $this->fail('暂不支持此操作'); + } $xlsx = new OrderDetail(); $order = WarehouseOrder::where('id', $id)->findOrEmpty(); $system_store = SystemStore::where('id', $order['store_id'])->value('name'); @@ -249,8 +254,12 @@ class WarehouseOrderController extends BaseAdminController // $value->total_price=bcmul($find['price'],$value['nums'],2); // $total_price+=$value->total_price; // }else{ + if($type==1){ $value->price = $value['purchase']; + $value->total_price=bcmul($value['purchase'],$value['nums'],2); $total_price+=$value->total_price; + } + // } $value->cart_num = $value['nums']; diff --git a/app/common/service/xlsx/WarehouseOrdeRentry.php b/app/common/service/xlsx/WarehouseOrdeRentry.php index 00496402..05af5bdd 100644 --- a/app/common/service/xlsx/WarehouseOrdeRentry.php +++ b/app/common/service/xlsx/WarehouseOrdeRentry.php @@ -34,7 +34,7 @@ class WarehouseOrdeRentry $sheet->setCellValue('G2', $order['code']??''); $sheet->setCellValue('A3', '序号'); $sheet->setCellValue('B3', '商品名称'); - $sheet->setCellValue('D3', '规格'); + $sheet->setCellValue('D3', '供应商'); $sheet->setCellValue('F3', '单位'); $sheet->setCellValue('G3', '单价'); $sheet->setCellValue('H3', '数量'); @@ -53,10 +53,10 @@ class WarehouseOrdeRentry $spreadsheet->getDefaultStyle()->applyFromArray($defaultStyle); foreach ($data as $k => $v) { - $sheet->setCellValue('A' . ($k + 4), $k+1 ); + $sheet->setCellValue('A' . ($k + 4), $v['product_id'] ); $sheet->setCellValue('B' . ($k + 4), $v['store_name']); $sheet->mergeCells('B' . ($k + 4) . ':C' . $k + 4); - $sheet->setCellValue('D' . ($k + 4), $v['store_info']); + $sheet->setCellValue('D' . ($k + 4), $v['supplier_name']); $sheet->mergeCells('D' . ($k + 4) . ':E' . $k + 4); $sheet->setCellValue('F' . ($k + 4), $v['unit_name']); $sheet->setCellValue('G' . ($k + 4), $v['purchase']);