diff --git a/app/admin/controller/warehouse_order/WarehouseOrderController.php b/app/admin/controller/warehouse_order/WarehouseOrderController.php index b6b4c6fa1..435d9df6e 100644 --- a/app/admin/controller/warehouse_order/WarehouseOrderController.php +++ b/app/admin/controller/warehouse_order/WarehouseOrderController.php @@ -230,15 +230,15 @@ class WarehouseOrderController extends BaseAdminController $total_price=0; foreach ($data as $key => &$value) { if(in_array($order['store_id'],[17,18])){ - $find = StoreBranchProduct::where('product_id', $value->product_id)->where('store_id',$order['store_id'])->withTrashed()->find(); + $find = StoreBranchProduct::where('product_id', $value->product_id)->where('store_id',$order['store_id'])->find(); }else{ - $find = StoreProduct::where('id', $value->product_id)->withTrashed()->find(); + $find = StoreProduct::where('id', $value->product_id)->find(); } $value->store_name = $find['store_name'] ?? ''; $value->store_info = $find['store_info'] ?? ''; if($type==2){ - $value->price = $find['purchase']; - $value->total_price=bcmul($find['purchase'],$value['nums'],2); + $value->price = $value['purchase']; + $value->total_price=bcmul($value['purchase'],$value['nums'],2); $total_price+=$value->total_price; }elseif($type==3){ $value->price = $find['cost']; @@ -284,14 +284,14 @@ class WarehouseOrderController extends BaseAdminController { $id = $this->request->post('id'); $warehouseOrder = WarehouseOrder::where('id', $id)->field('store_id,delivery_time')->find(); - $system_store = SystemStore::where('id', $warehouseOrder['store_id'])->value('name'); - $data = WarehouseProduct::where('oid', $id)->where('financial_pm',0)->field('product_id,nums')->select() + $system_store = SystemStore::where('id', $warehouseOrder['store_id'])->value('introduction'); + $data = WarehouseProduct::where('oid', $id)->where('financial_pm',0)->field('oid,product_id,nums')->select() ->each(function ($item) use ($system_store,$warehouseOrder) { - $item['system_store'] = $system_store; + $item['system_store'] = $system_store.' '.$item['oid']; $find = StoreProduct::where('id', $item['product_id'])->field('store_name,unit')->find(); $item['store_name'] = $find['store_name']; $unit_name = StoreProductUnit::where('id', $find['unit'])->value('name'); - $item['unit_name'] = $item['nums'].'/'.$unit_name.' '.date('m-d',$warehouseOrder['delivery_time']); + $item['unit_name'] = $item['nums'].'/'.$unit_name.' '.date('m-d',$warehouseOrder['delivery_time']); }) ->toArray(); $file_path=(new Beforehand())->export($data, $system_store); diff --git a/app/api/controller/IndexController.php b/app/api/controller/IndexController.php index 47238ffbb..d72bd27f3 100644 --- a/app/api/controller/IndexController.php +++ b/app/api/controller/IndexController.php @@ -48,41 +48,6 @@ class IndexController extends BaseApiController public function index() { - // 创建一个新的PHPWord文档 - $phpWord = new \PhpOffice\PhpWord\PhpWord(); - - // 添加一个节 - $section = $phpWord->addSection(array( - 'pageSizeW' => Converter::cmToTwip(4), // 宽度转换为twips - 'pageSizeH' => Converter::cmToTwip(2), // 高度转换为twips - 'marginLeft' => Converter::cmToTwip(0.2), - 'marginRight' => Converter::cmToTwip(0), - 'marginTop' => Converter::cmToTwip(0.2), - 'marginBottom' => Converter::cmToTwip(0), - )); - - // 在节中添加一些内容 - // 添加文本 - $text = '这是一段测试文本,啊实打实的'; - $text1 = '这是一段测试文本,啊实打实的'; - $text2 = '这是一段测试文本,啊实打实的'; - // 检查文本宽度是否超过纸张宽度 - $fontStyle = ['name' => 'Arial', 'size' => 12, 'bold' => true]; - - // 比较文本宽度和纸张宽度 - $section->addText(mb_substr($text, 0, 8, 'UTF-8'), $fontStyle); - $section->addText(mb_substr($text1, 0, 8, 'UTF-8'), $fontStyle); - $section->addText(mb_substr($text2, 0, 8, 'UTF-8'), $fontStyle); - $section->addText(mb_substr($text, 0, 8, 'UTF-8'), $fontStyle); - $section->addText(mb_substr($text1, 0, 8, 'UTF-8'), $fontStyle); - $section->addText(mb_substr($text2, 0, 8, 'UTF-8'), $fontStyle); - - $objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007'); - - $url = '/export/' . date('Y-m') . '/' . '标签单-' . date('Y-m-d') . '.docx'; - - $a = $objWriter->save(public_path() . $url); - d($a); return json(1); $financeFlow = new StoreFinanceFlow();