hrjy 2 years ago
parent
commit
67a84fed58

+ 3 - 1
app/admin/controller/water/WaterOrder.php

@@ -240,15 +240,17 @@ class WaterOrder extends AuthController
             $export[] = [
                 $item['title'],
                 $item['name'],
+                $item['code'],
                 $item['specifications'],
                 $item['number'],
                 $item['unit_price'],
                 $item['ot_price'],
+                $item['weight'],
                 $item['company'],
                 $item['create_time'],
             ];
         }
-        PHPExcelService::setExcelHeader(['标题', '名称', '规格', '数量', '单价', '总价', '单位','时间'])
+        PHPExcelService::setExcelHeader(['标题', '名称','编号', '规格', '数量', '单价', '总价','重量', '单位','时间'])
             ->setExcelTile('用户'.$user['phone'].'计算订单导出-总价'.$details['price'], '计算订单' . time(), '记录ID'.$details['id'].'-水口价格'.$details['water_mouth'].'-隔板价格'.$details['partition'].'-税点'.($details['tax_point']).'%')
             ->setExcelContent($export)
             ->ExcelSave();

+ 3 - 1
app/admin/controller/water/WaterQuery.php

@@ -185,15 +185,17 @@ class WaterQuery extends AuthController
             $export[] = [
                 $item['title'],
                 $item['name'],
+                $item['code'],
                 $item['specifications'],
                 $item['number'],
                 $item['unit_price'],
                 $item['ot_price'],
+                $item['weight'],
                 $item['company'],
                 $item['create_time'],
             ];
         }
-        PHPExcelService::setExcelHeader(['标题', '名称', '规格', '数量', '单价', '总价', '单位','时间'])
+        PHPExcelService::setExcelHeader(['标题', '名称','编号', '规格', '数量', '单价', '总价', '重量','单位','时间'])
             ->setExcelTile('用户'.$user['phone'].'计算记录导出', '计算信息' . time(), '记录ID'.$details['id'].'-总价'.$details['price'])
             ->setExcelContent($export)
             ->ExcelSave();

+ 4 - 0
app/admin/view/water/water_query/details.php

@@ -17,6 +17,7 @@
 <!--                            <th class="text-center">编号</th>-->
                             <th class="text-center">名称</th>
                             <th class="text-center">分类</th>
+                            <th class="text-center">编号</th>
                             <th class="text-center">规格</th>
                             <th class="text-center">数量</th>
                             <th class="text-center">单价</th>
@@ -38,6 +39,9 @@
                             <td class="text-center">
                                 {$vo.name}
                             </td>
+                            <td class="text-center">
+                                {$vo.code}
+                            </td>
                             <td class="text-center">
                                 {$vo.specifications}
                             </td>

+ 17 - 16
app/api/controller/water/WaterQueryController.php

@@ -138,19 +138,19 @@ class WaterQueryController
 
                 $zj += $details['unit_price'] * $v;
                 $zzl += $details['weight'] * $v;
-                $table[] = ['title' => '顶板', 'name' => $details['name'], 'specifications' => $details['long'].'m*'.$details['wide'].'m', 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weight' => $details['weight'] * $v ,'type' => 1];
+                $table[] = ['title' => '顶板', 'name' => $details['name'], 'specifications' => $details['long'].'m*'.$details['wide'].'m', 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weights' => $details['weight'] * $v ,'weight' => $details['weight'],'code' => $details['number'],'type' => 1];
             }elseif ($k == '1*0.5'){
                 $details = WaterMaterialScience::where('cate_id', $data['roof'])->where($where)->where([['long', '=', 1], ['wide', '=', 0.5]])->find();
 
                 $zj += $details['unit_price'] * $v;
                 $zzl += $details['weight'] * $v;
-                $table[] = ['title' => '顶板','name' => $details['name'], 'specifications' =>  $details['long'].'m*'.$details['wide'].'m', 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weight' => $details['weight'] * $v ,'type' => 1];
+                $table[] = ['title' => '顶板','name' => $details['name'], 'specifications' =>  $details['long'].'m*'.$details['wide'].'m', 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weights' => $details['weight'] * $v ,'weight' => $details['weight'],'code' => $details['number'],'type' => 1];
             }elseif ($k == '0.5*0.5'){
                 $details = WaterMaterialScience::where('cate_id', $data['roof'])->where($where)->where([['long', '=', 0.5], ['wide', '=', 0.5]])->find();
 
                 $zj += $details['unit_price'] * $v;
                 $zzl += $details['weight'] * $v;
-                $table[] = ['title' => '顶板','name' => $details['name'], 'specifications' =>  $details['long'].'m*'.$details['wide'].'m', 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weight' => $details['weight'] * $v , 'type' => 1];
+                $table[] = ['title' => '顶板','name' => $details['name'], 'specifications' =>  $details['long'].'m*'.$details['wide'].'m', 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weights' => $details['weight'] * $v ,'weight' => $details['weight'],'code' => $details['number'], 'type' => 1];
             }
         }
         // 底板
@@ -162,7 +162,7 @@ class WaterQueryController
                 $floor1 = $floor / $m2;
                 $zj +=  $item['unit_price'] * $floor1;
                 $zzl += $item['weight'] * $floor1;
-                $table[] = ['title' => '底板', 'name' => $item['name'], 'specifications' =>  $item['long'].'m*'.$item['wide'].'m', 'number' => $floor1, 'unit_price' => $item['unit_price'], 'company' => $item['company'], 'ot_price' => $item['unit_price'] * $floor1, 'weight' => $item['weight'] * $floor1, 'type' => 4];
+                $table[] = ['title' => '底板', 'name' => $item['name'], 'specifications' =>  $item['long'].'m*'.$item['wide'].'m', 'number' => $floor1, 'unit_price' => $item['unit_price'], 'company' => $item['company'], 'ot_price' => $item['unit_price'] * $floor1, 'weights' => $item['weight'] * $floor1,'weight' => $details['weight'],'code' => $details['number'], 'type' => 4];
             }
         }else {
             $floor = $calculation['floor_number'];
@@ -180,7 +180,7 @@ class WaterQueryController
 //                        }
                         $zj +=  $item['unit_price'] * $floor1;
                         $zzl += $item['weight'] * $floor1;
-                        $table[] = ['title' => '底板', 'name' => $item['name'], 'specifications' =>  $item['long'].'m*'.$item['wide'].'m', 'number' => $floor1, 'unit_price' => $item['unit_price'], 'company' => $item['company'], 'ot_price' => $item['unit_price'] * $floor1, 'weight' => $item['weight'] * $floor1, 'type' => 4];
+                        $table[] = ['title' => '底板', 'name' => $item['name'], 'specifications' =>  $item['long'].'m*'.$item['wide'].'m', 'number' => $floor1, 'unit_price' => $item['unit_price'], 'company' => $item['company'], 'ot_price' => $item['unit_price'] * $floor1, 'weights' => $item['weight'] * $floor1,'weight' => $details['weight'],'code' => $details['number'], 'type' => 4];
                     }
                 }
             }
@@ -195,19 +195,19 @@ class WaterQueryController
                     $details = WaterMaterialScience::where('cate_id', $data['side_plate'][$storey-1])->where($where)->where([['long', '=', 1], ['wide', '=', 1]])->find();
                     $zj += $details['unit_price'] * $v;
                     $zzl += $details['weight'] * $v;
-                    $tables[] = ['title' => '侧板'.$storey.'层' , 'name' => $details['name'], 'specifications' =>  $details['long'].'m*'.$details['wide'].'m', 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weight' => $details['weight'] * $v , 'type' => 2];
+                    $tables[] = ['title' => '侧板'.$storey.'层' , 'name' => $details['name'], 'specifications' =>  $details['long'].'m*'.$details['wide'].'m', 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weights' => $details['weight'] * $v , 'weight' => $details['weight'],'code' => $details['number'],'type' => 2];
                 }elseif ($k == '1*0.5'){
                     $details = WaterMaterialScience::where('cate_id', $data['side_plate'][$storey-1])->where($where)->where([['long', '=', 1], ['wide', '=', 0.5]])->find();
 
                     $zj += $details['unit_price'] * $v;
                     $zzl += $details['weight'] * $v;
-                    $tables[] = ['title' => '侧板'.$storey.'层' , 'name' => $details['name'], 'specifications' =>  $details['long'].'m*'.$details['wide'].'m', 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weight' => $details['weight'] * $v , 'type' => 2];
+                    $tables[] = ['title' => '侧板'.$storey.'层' , 'name' => $details['name'], 'specifications' =>  $details['long'].'m*'.$details['wide'].'m', 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weights' => $details['weight'] * $v ,'weight' => $details['weight'],'code' => $details['number'], 'type' => 2];
                 }elseif ($k == '0.5*0.5'){
                     $details = WaterMaterialScience::where('cate_id', $data['side_plate'][$storey-1])->where($where)->where([['long', '=', 0.5], ['wide', '=', 0.5]])->find();
 
                     $zj += $details['unit_price'] * $v;
                     $zzl += $details['weight'] * $v;
-                    $tables[] = ['title' => '侧板'.$storey.'层' , 'name' => $details['name'], 'specifications' =>  $details['long'].'m*'.$details['wide'].'m', 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weight' => $details['weight'] * $v , 'type' => 2];
+                    $tables[] = ['title' => '侧板'.$storey.'层' , 'name' => $details['name'], 'specifications' =>  $details['long'].'m*'.$details['wide'].'m', 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weights' => $details['weight'] * $v ,'weight' => $details['weight'],'code' => $details['number'], 'type' => 2];
                 }
             }
         }
@@ -224,7 +224,7 @@ class WaterQueryController
             $details = WaterMaterialScience::where('cate_id', $data['lacing'][$lac_storey-1])->where($where)->find();
             $zj += $details['unit_price'] * $v;
             $zzl += $details['weight'] * $v;
-            $tables1[] = ['title' => '主拉'.$lac_storey.'层' , 'name' => $details['name'], 'specifications' =>  $details['long'].'*'.$details['wide'].'*'.'2.1', 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weight' => $details['weight'] * $v , 'type' => 3];
+            $tables1[] = ['title' => '主拉'.$lac_storey.'层' , 'name' => $details['name'], 'specifications' =>  $details['long'].'*'.$details['wide'].'*'.'2.1', 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weights' => $details['weight'] * $v ,'weight' => $details['weight'],'code' => $details['number'], 'type' => 3];
         }
 
         //辅拉
@@ -234,7 +234,7 @@ class WaterQueryController
             $details = WaterMaterialScience::where('cate_id', $data['fula'][$fula_storey-1])->where($where)->find();
             $zj += $details['unit_price'] * $v;
             $zzl += $details['weight'] * $v;
-            $tables2[] = ['title' => '辅拉'.$fula_storey.'层' , 'name' => $details['name'], 'specifications' =>  $details['long'].'*'.$details['wide'].'*'.'2.1', 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weight' => $details['weight'] * $v , 'type' => 6];
+            $tables2[] = ['title' => '辅拉'.$fula_storey.'层' , 'name' => $details['name'], 'specifications' =>  $details['long'].'*'.$details['wide'].'*'.'2.1', 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weights' => $details['weight'] * $v ,'weight' => $details['weight'],'code' => $details['number'], 'type' => 6];
         }
 
         $table = array_merge($table, Array_reverse($tables1));
@@ -243,7 +243,7 @@ class WaterQueryController
         $details = WaterMaterialScience::where('cate_id', $data['column'])->where($where)->find();
         $zj += $details['unit_price'] * $calculation['column_number'];
         $zzl += $details['weight'] * $calculation['column_number'];
-        $table[] = ['title' => '立柱' , 'name' => $details['name'], 'specifications' =>  $details['long'].'*'.$details['wide'].'*'.'2.1', 'number' => $calculation['column_number'], 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $calculation['column_number'], 'weight' => $details['weight'] * $calculation['column_number'] , 'type' => 5];
+        $table[] = ['title' => '立柱' , 'name' => $details['name'], 'specifications' =>  $details['long'].'*'.$details['wide'].'*'.'2.1', 'number' => $calculation['column_number'], 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $calculation['column_number'], 'weights' => $details['weight'] * $calculation['column_number'] ,'weight' => $details['weight'],'code' => $details['number'], 'type' => 5];
 
         //保温
         foreach ($calculation['warm'] as $k => $v){
@@ -251,17 +251,17 @@ class WaterQueryController
                 $details = WaterMaterialScience::where('cate_id', $data['warm'])->where([['long', '=', 1], ['wide', '=', 1]])->where($where)->find();
                 $zj += $details['unit_price'] * $v;
                 $zzl += $details['weight'] * $v;
-                $table[] = ['title' => '保温板' , 'name' => $details['name'], 'specifications' => '1m*1m', 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weight' => $details['weight'] * $v , 'type' => 7];
+                $table[] = ['title' => '保温板' , 'name' => $details['name'], 'specifications' => '1m*1m', 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weights' => $details['weight'] * $v ,'weight' => $details['weight'],'code' => $details['number']??'无', 'type' => 7];
             }elseif ($k == 'warm2' and $v > 0){
                 $details = WaterMaterialScience::where('cate_id', $data['warm'])->where([['long', '=', 1], ['wide', '=', 0.5]])->where($where)->find();
                 $zj += $details['unit_price'] * $v;
                 $zzl += $details['weight'] * $v;
-                $table[] = ['title' => '保温板' , 'name' => $details['name'], 'specifications' => '1m*0.5m', 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weight' => $details['weight'] * $v , 'type' => 7];
+                $table[] = ['title' => '保温板' , 'name' => $details['name'], 'specifications' => '1m*0.5m', 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weights' => $details['weight'] * $v ,'weight' => $details['weight'],'code' => $details['number']??'无', 'type' => 7];
             }elseif ($k == 'warm3' and $v > 0){
                 $details = WaterMaterialScience::where('cate_id', $data['warm'])->where([['long', '=', 0.5], ['wide', '=', 0.5]])->where($where)->find();
                 $zj += $details['unit_price'] * $v;
                 $zzl += $details['weight'] * $v;
-                $table[] = ['title' => '保温板' , 'name' => $details['name'], 'specifications' => '0.5m*0.5m', 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weight' => $details['weight'] * $v , 'type' => 7];
+                $table[] = ['title' => '保温板' , 'name' => $details['name'], 'specifications' => '0.5m*0.5m', 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weights' => $details['weight'] * $v ,'weight' => $details['weight'],'code' => $details['number']??'无', 'type' => 7];
             }
 
         }
@@ -270,7 +270,7 @@ class WaterQueryController
             $details = WaterMaterialScience::where('cate_id', $data['channel'])->where($where)->find();
             $zj += $details['unit_price'] * $calculation['channel_number'];
             $zzl += $details['weight'] * $calculation['channel_number'];
-            $table[] = ['title' => '槽钢' , 'name' => $details['name'], 'specifications' => $details['company'], 'number' => $calculation['channel_number'], 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $calculation['channel_number'], 'weight' => $details['weight'] * $calculation['channel_number'] , 'type' => 8];
+            $table[] = ['title' => '槽钢' , 'name' => $details['name'], 'specifications' => $details['company'], 'number' => $calculation['channel_number'], 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $calculation['channel_number'], 'weights' => $details['weight'] * $calculation['channel_number'] ,'weight' => $details['weight'],'code' => $details['number']??'无', 'type' => 8];
         }
 
         // 扶梯
@@ -278,7 +278,7 @@ class WaterQueryController
             $details = WaterMaterialScience::where('cate_id', 9)->find();
             $zj += $details['unit_price'] * $calculation['ladder'];
             $zzl += $details['weight'] * $calculation['ladder'];
-            $table[] = ['title' => '扶梯' , 'name' => $details['name'], 'specifications' => $details['company'], 'number' => $calculation['ladder'], 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $calculation['ladder'], 'weight' => $details['weight'] * $calculation['ladder'] , 'type' => 9];
+            $table[] = ['title' => '扶梯' , 'name' => $details['name'], 'specifications' => $details['company'], 'number' => $calculation['ladder'], 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $calculation['ladder'], 'weights' => $details['weight'] * $calculation['ladder'] ,'weight' => $details['weight'],'code' => $details['number']??'无', 'type' => 9];
         }
 
         foreach ($table as &$i){
@@ -290,6 +290,7 @@ class WaterQueryController
         }else{
             $zj += 105;
         }
+        $zzl = $zzl * (sys_config('weight')/100);
         if ($discount > 0){
             foreach ($table as &$item)
             {