|
@@ -2,11 +2,16 @@
|
|
|
|
|
|
namespace app\api\controller\water;
|
|
|
|
|
|
+use app\admin\model\water\WaterCate;
|
|
|
+use app\admin\model\water\WaterMaterial;
|
|
|
use app\admin\model\water\WaterMaterialScience;
|
|
|
+use app\admin\model\water\WaterQuery;
|
|
|
+use app\models\user\User;
|
|
|
use app\Request;
|
|
|
use crmeb\services\GroupDataService;
|
|
|
use crmeb\services\QrcodeService;
|
|
|
use crmeb\services\UtilService;
|
|
|
+use think\facade\Db;
|
|
|
|
|
|
/**
|
|
|
* 秒杀产品类
|
|
@@ -16,7 +21,7 @@ use crmeb\services\UtilService;
|
|
|
class WaterQueryController
|
|
|
{
|
|
|
|
|
|
- public function calculation(Request $request)
|
|
|
+ public function query(Request $request)
|
|
|
{
|
|
|
$data = UtilService::postMore([
|
|
|
['long', ''],// 长
|
|
@@ -26,19 +31,208 @@ class WaterQueryController
|
|
|
['is_channel', ''], // 是否需要槽钢
|
|
|
['is_human_ladder', ''] ,// 是否需要人梯
|
|
|
['is_gc', ''] ,// 公差
|
|
|
- ['floor', ''], // 底板厚度
|
|
|
- ['side_plate', ''], // 侧板厚度
|
|
|
['roof', ''], // 顶板厚度
|
|
|
+ ['floor', ''], // 底板厚度
|
|
|
+ ['side_plate', []], // 侧板厚度
|
|
|
['column', ''], // 立柱厚度
|
|
|
- ['lacing', ''], // 拉筋厚度
|
|
|
- ['fula', ''], // 辅拉
|
|
|
+ ['lacing', []], // 拉筋厚度
|
|
|
+ ['fula', []], // 辅拉
|
|
|
]);
|
|
|
+ $user = User::where('uid', $request->uid())->find();
|
|
|
+ if ($user['member'] == 0){
|
|
|
+ if ($user['frequency'] == 0 and $user['free'] == 0){
|
|
|
+ return app('json')->fail('查询次数已用完');
|
|
|
+ }
|
|
|
+ }
|
|
|
//顶板
|
|
|
+ $calculation = $this->calculation($data);
|
|
|
+ $amount = $this->AmountOfMoney($calculation, $data);// 计算总价,表格
|
|
|
+ Db::startTrans();
|
|
|
+ try {
|
|
|
+ $res = WaterQuery::create([
|
|
|
+ 'uid' => $request->uid(),
|
|
|
+ 'long' => $data['long'],
|
|
|
+ 'wide' => $data['wide'],
|
|
|
+ 'high' => $data['high'],
|
|
|
+ 'is_warm' => $data['is_warm'],
|
|
|
+ 'is_channel' => $data['is_channel'],
|
|
|
+ 'is_ladder' => $data['is_human_ladder'],
|
|
|
+ 'is_gc' => $data['is_gc'],
|
|
|
+ 'price' => $amount['zj'],
|
|
|
+ 'weight' => $amount['zzl'],
|
|
|
+ ]);
|
|
|
+ foreach ($amount['table'] as $item){
|
|
|
+ $item['query_id'] = $res['id'];
|
|
|
+ WaterMaterial::create($item);
|
|
|
+ }
|
|
|
+ if ($user['member'] == 0){
|
|
|
+ if ($user['free'] > 0){
|
|
|
+ User::where('uid', $request->uid())->dec('free', 1)->update();
|
|
|
+ }else{
|
|
|
+ User::where('uid', $request->uid())->dec('frequency', 1)->update();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Db::commit();
|
|
|
+ return app('json')->success($amount);
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ Db::rollback();
|
|
|
+ return app('json')->fail($e->getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public function AmountOfMoney($calculation, $data)
|
|
|
+ {
|
|
|
+ $table = [];
|
|
|
+ $zj = 0; //总价
|
|
|
+ $zzl = 0; // 总重量
|
|
|
if ($data['is_gc'] > 0){
|
|
|
$where[] = ['is_gc', '=' ,1];
|
|
|
}else{
|
|
|
$where[] = ['is_gc', '=' ,0];
|
|
|
}
|
|
|
+ foreach ($calculation['roof_number'] as $k => $v){
|
|
|
+ if ($k == '1*1'){
|
|
|
+ $details = WaterMaterialScience::where('cate_id', $data['roof'])->where($where)->where([['long', '=', 1], ['wide', '=', 1]])->find();
|
|
|
+
|
|
|
+ $zj += $details['unit_price'] * $v;
|
|
|
+ $zzl += $details['weight'] * $v;
|
|
|
+ $table[] = ['title' => '顶板', 'name' => $details['name'], 'specifications' => $details['long'].'*'.$details['wide'], 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weight' => $details['weight'] * $v ,'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'].'*'.$details['wide'], 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weight' => $details['weight'] * $v ,'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'].'*'.$details['wide'], 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weight' => $details['weight'] * $v , 'type' => 1];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 底板
|
|
|
+ foreach ($calculation['floor_number'] as $k => $v){
|
|
|
+ if ($k == '1*1'){
|
|
|
+ $details = WaterMaterialScience::where('cate_id', $data['floor'])->where($where)->where([['long', '=', 1], ['wide', '=', 1]])->find();
|
|
|
+
|
|
|
+ $zj += $details['unit_price'] * $v;
|
|
|
+ $zzl += $details['weight'] * $v;
|
|
|
+ $table[] = ['title' => '底板','name' => $details['name'], 'specifications' => $details['long'].'*'.$details['wide'], 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weight' => $details['weight'] * $v ,'type' => 4];
|
|
|
+ }elseif ($k == '1*0.5'){
|
|
|
+ $details = WaterMaterialScience::where('cate_id', $data['floor'])->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'].'*'.$details['wide'], 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weight' => $details['weight'] * $v ,'type' => 4];
|
|
|
+ }elseif ($k == '0.5*0.5'){
|
|
|
+ $details = WaterMaterialScience::where('cate_id', $data['floor'])->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'].'*'.$details['wide'], 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weight' => $details['weight'] * $v , 'type' => 4];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 侧板
|
|
|
+ $storey = 0;
|
|
|
+ foreach ($calculation['side_number'] as $item){
|
|
|
+ $storey ++;
|
|
|
+ foreach ($item as $k => $v){
|
|
|
+ if ($k == '1*1'){
|
|
|
+ $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;
|
|
|
+ $table[] = ['title' => '侧板B'.$storey.'层' , 'name' => $details['name'], 'specifications' => $details['long'].'*'.$details['wide'], 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weight' => $details['weight'] * $v , '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;
|
|
|
+ $table[] = ['title' => '侧板B'.$storey.'层' , 'name' => $details['name'], 'specifications' => $details['long'].'*'.$details['wide'], 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weight' => $details['weight'] * $v , '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;
|
|
|
+ $table[] = ['title' => '侧板B'.$storey.'层' , 'name' => $details['name'], 'specifications' => $details['long'].'*'.$details['wide'], 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weight' => $details['weight'] * $v , 'type' => 2];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //拉筋
|
|
|
+ $lac_storey = 0;
|
|
|
+ foreach ($calculation['lacing_number'] as $v){
|
|
|
+ $lac_storey ++;
|
|
|
+ $details = WaterMaterialScience::where('cate_id', $data['lacing'][$lac_storey-1])->where($where)->find();
|
|
|
+ $zj += $details['unit_price'] * $v;
|
|
|
+ $zzl += $details['weight'] * $v;
|
|
|
+ $table[] = ['title' => '辅拉B'.$lac_storey.'层' , 'name' => $details['name'], 'specifications' => '1', 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weight' => $details['weight'] * $v , 'type' => 3];
|
|
|
+ }
|
|
|
+
|
|
|
+ $fula_storey = 0;
|
|
|
+ foreach ($calculation['fula_number'] as $v){
|
|
|
+ $fula_storey ++;
|
|
|
+ $details = WaterMaterialScience::where('cate_id', $data['fula'][$fula_storey-1])->where($where)->find();
|
|
|
+ $zj += $details['unit_price'] * $v;
|
|
|
+ $zzl += $details['weight'] * $v;
|
|
|
+ $table[] = ['title' => '辅拉B'.$fula_storey.'层' , 'name' => $details['name'], 'specifications' => '1', 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weight' => $details['weight'] * $v , 'type' => 6];
|
|
|
+ }
|
|
|
+
|
|
|
+ // 立柱
|
|
|
+ $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' => '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];
|
|
|
+
|
|
|
+ //保温
|
|
|
+ foreach ($calculation['warm'] as $k => $v){
|
|
|
+ if ($k == 'warm1' and $v > 0){
|
|
|
+ $details = WaterMaterialScience::where('cate_id', $data['is_warm'])->where([['long', '=', 1], ['wide', '=', 1]])->where($where)->find();
|
|
|
+ $zj += $details['unit_price'] * $v;
|
|
|
+ $zzl += $details['weight'] * $v;
|
|
|
+ $table[] = ['title' => '保温板' , 'name' => $details['name'], 'specifications' => '1*1', 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weight' => $details['weight'] * $v , 'type' => 7];
|
|
|
+ }elseif ($k == 'warm2' and $v > 0){
|
|
|
+ $details = WaterMaterialScience::where('cate_id', $data['is_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' => '1*0.5', 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weight' => $details['weight'] * $v , 'type' => 7];
|
|
|
+ }elseif ($k == 'warm3' and $v > 0){
|
|
|
+ $details = WaterMaterialScience::where('cate_id', $data['is_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.5*0.5', 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weight' => $details['weight'] * $v , 'type' => 7];
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ //槽钢
|
|
|
+ if ($data['is_channel'] > 0){
|
|
|
+ $details = WaterMaterialScience::where('cate_id', $data['is_channel'])->where($where)->find();
|
|
|
+ $zj += $details['unit_price'] * $calculation['channel_number'];
|
|
|
+ $zzl += $details['weight'] * $calculation['channel_number'];
|
|
|
+ $table[] = ['title' => '槽钢' , 'name' => $details['name'], 'specifications' => '1', '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];
|
|
|
+ }
|
|
|
+
|
|
|
+ // 扶梯
|
|
|
+ if ($data['is_human_ladder'] > 0){
|
|
|
+ $details = WaterMaterialScience::where('cate_id', 9)->find();
|
|
|
+ $zj += $details['unit_price'] * $calculation['ladder'];
|
|
|
+ $zzl += $details['weight'] * $calculation['ladder'];
|
|
|
+ $table[] = ['title' => '扶梯' , 'name' => $details['name'], 'specifications' => '1', '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];
|
|
|
+ }
|
|
|
+
|
|
|
+ return ['table' => $table, 'zj' => $zj, 'zzl' => $zzl];
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**计算使用材料数量
|
|
|
+ * @param $data
|
|
|
+ * @return array
|
|
|
+ */
|
|
|
+ public function calculation($data)
|
|
|
+ {
|
|
|
+
|
|
|
$long = (double)$data['long'];
|
|
|
$wide = (double)$data['wide'];
|
|
|
$high = (double)$data['high'];
|
|
@@ -48,8 +242,9 @@ class WaterQueryController
|
|
|
$side_number = []; // 侧板数量
|
|
|
$lacing_number = []; // 拉经数量
|
|
|
$fula_number = [];//辅拉数量
|
|
|
- $warm = []; //保温数量
|
|
|
- $channel_number = 0;
|
|
|
+ $column_number = 0;// 立柱数量
|
|
|
+ $channel_number = 0; // 槽钢
|
|
|
+ $ladder = 0;// 扶梯管米数
|
|
|
for ($i = 0; $i < intval($high); $i++){
|
|
|
$high_array[] = 1;
|
|
|
}
|
|
@@ -69,7 +264,7 @@ class WaterQueryController
|
|
|
$floor_number = ['1*1' => intval($long) * intval($wide), '1*0.5' => intval($long) + intval($wide), '0.5*0.5' => 1];// 底板数量
|
|
|
foreach ($high_array as $item){
|
|
|
if ($item >= 1){
|
|
|
- $side_number[] = ['1*1' => ((intval($long)) + (intval($wide))) * 2, '0.1*0.5' => 4];
|
|
|
+ $side_number[] = ['1*1' => ((intval($long)) + (intval($wide))) * 2, '1*0.5' => 4];
|
|
|
}else{
|
|
|
$side_number[] = ['1*0.5' => ((intval($long)) + (intval($wide))) * 2, '0.5*0.5' => 4];
|
|
|
}
|
|
@@ -80,26 +275,26 @@ class WaterQueryController
|
|
|
$roof_number = ['1*1' => intval($long) * intval($wide), '1*0.5' => $wide]; // 顶板数量
|
|
|
$floor_number = ['1*1' => intval($long) * intval($wide), '1*0.5' => $wide];// 底板数量
|
|
|
foreach ($high_array as $item){
|
|
|
- $side_number[] = ['1*1' => ((intval($long)) + (intval($wide))) * 2, '0.1*0.5' => 2];
|
|
|
+ $side_number[] = ['1*1' => ((intval($long)) + (intval($wide))) * 2, '1*0.5' => 2];
|
|
|
}
|
|
|
}elseif (ceil($long) == $long && ceil($wide) != $wide and ceil($high) == $high){
|
|
|
$roof_number = ['1*1' => intval($long) * intval($wide), '1*0.5' => $long]; // 顶板数量
|
|
|
$floor_number = ['1*1' => intval($long) * intval($wide), '1*0.5' => $long];// 底板数量
|
|
|
foreach ($high_array as $item){
|
|
|
- $side_number[] = ['1*1' => ((intval($long)) + (intval($wide))) * 2, '0.1*0.5' => 2];
|
|
|
+ $side_number[] = ['1*1' => ((intval($long)) + (intval($wide))) * 2, '1*0.5' => 2];
|
|
|
}
|
|
|
}elseif (ceil($long) != $long && ceil($wide) != $wide and ceil($high) == $high){
|
|
|
$roof_number = ['1*1' => intval($long) * intval($wide), '1*0.5' => intval($long) + intval($wide), '0.5*0.5' => 1]; // 顶板数量
|
|
|
$floor_number = ['1*1' => intval($long) * intval($wide), '1*0.5' => intval($long) + intval($wide), '0.5*0.5' => 1];// 底板数量
|
|
|
foreach ($high_array as $item){
|
|
|
- $side_number[] = ['1*1' => ((intval($long)) + (intval($wide))) * 2, '0.1*0.5' => 4];
|
|
|
+ $side_number[] = ['1*1' => ((intval($long)) + (intval($wide))) * 2, '1*0.5' => 4];
|
|
|
}
|
|
|
} elseif (ceil($long) != $long && ceil($wide) == $wide and ceil($high) != $high){
|
|
|
$roof_number = ['1*1' => intval($long) * intval($wide), '1*0.5' => $wide]; // 顶板数量
|
|
|
$floor_number = ['1*1' => intval($long) * intval($wide), '1*0.5' => $wide];// 底板数量
|
|
|
foreach ($high_array as $item){
|
|
|
if ($item >= 1){
|
|
|
- $side_number[] = ['1*1' => ((intval($long)) + (intval($wide))) * 2, '0.1*0.5' => 2];
|
|
|
+ $side_number[] = ['1*1' => ((intval($long)) + (intval($wide))) * 2, '1*0.5' => 2];
|
|
|
}else{
|
|
|
$side_number[] = ['1*0.5' => ((intval($long)) + (intval($wide))) * 2, '0.5*0.5' => 2];
|
|
|
}
|
|
@@ -109,7 +304,7 @@ class WaterQueryController
|
|
|
$floor_number = ['1*1' => intval($long) * intval($wide), '1*0.5' => $long];// 底板数量
|
|
|
foreach ($high_array as $item){
|
|
|
if ($item >= 1){
|
|
|
- $side_number[] = ['1*1' => ((intval($long)) + (intval($wide))) * 2, '0.1*0.5' => 2];
|
|
|
+ $side_number[] = ['1*1' => ((intval($long)) + (intval($wide))) * 2, '1*0.5' => 2];
|
|
|
}else{
|
|
|
$side_number[] = ['1*0.5' => ((intval($long)) + (intval($wide))) * 2, '0.5*0.5' => 2];
|
|
|
}
|
|
@@ -130,7 +325,7 @@ class WaterQueryController
|
|
|
array_pop($high_array);// 删除最后一位,算出主拉层数
|
|
|
// 拉筋
|
|
|
foreach ($high_array as $item){
|
|
|
- $lacing_number[] = ceil(((ceil($long) * (ceil($wide) - 1)) + (ceil($wide) * (ceil($long) - 1)))/2);
|
|
|
+ $lacing_number[] = ceil((($long * (ceil($wide) - 1)) + ($wide * (ceil($long) - 1)))/2);
|
|
|
}
|
|
|
// 辅拉
|
|
|
if ($high > 1){
|
|
@@ -154,6 +349,9 @@ class WaterQueryController
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ //立柱
|
|
|
+ $column_number = ceil((ceil($long) - 1) * (ceil($wide) -1) * $wide / 2);
|
|
|
+ //保温板数量
|
|
|
$warm1 = 0;// 1*1 数量
|
|
|
$warm2 = 0;// 1*0.5数量
|
|
|
$warm3 = 0;// 0.5*0.5数量
|
|
@@ -181,7 +379,7 @@ class WaterQueryController
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ //槽钢
|
|
|
if ($data['is_channel'] > 0){
|
|
|
if (ceil($long) == $long && ceil($wide) == $wide && ceil($high) == $high){
|
|
|
//都为整数
|
|
@@ -192,7 +390,29 @@ class WaterQueryController
|
|
|
$channel_number = $long * (ceil($wide) * 2 + 1) + $wide * 2;
|
|
|
}
|
|
|
}
|
|
|
- halt($channel_number);
|
|
|
+ // 扶梯管
|
|
|
+ if ($data['is_human_ladder'] > 0){
|
|
|
+ if ($high <= 1.5){
|
|
|
+ $ladder = 5;
|
|
|
+ }elseif ($high == 2){
|
|
|
+ $ladder = 7;
|
|
|
+ }elseif ($high >= 2.5){
|
|
|
+ $ladder = $high * 4;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $calculation = [
|
|
|
+ 'roof_number' => $roof_number,// 顶板
|
|
|
+ 'floor_number' => $floor_number,// 底板
|
|
|
+ 'side_number' => $side_number,// 侧板
|
|
|
+ 'lacing_number' => $lacing_number,// 拉筋
|
|
|
+ 'fula_number' => $fula_number,// 辅拉
|
|
|
+ 'column_number' => $column_number,// 立柱
|
|
|
+ 'warm' => ['warm1' => $warm1,'warm2' => $warm2,'warm3' => $warm3],// 保温
|
|
|
+ 'channel_number' => $channel_number,// 槽钢
|
|
|
+ 'ladder' => $ladder,// 保温
|
|
|
+ ];
|
|
|
+
|
|
|
+ return $calculation;
|
|
|
|
|
|
}
|
|
|
|
|
@@ -206,24 +426,50 @@ class WaterQueryController
|
|
|
*/
|
|
|
public function list()
|
|
|
{
|
|
|
- $data = UtilService::getMore(['is_gc']);
|
|
|
$list = [];
|
|
|
- if ($data['is_gc'] > 0){
|
|
|
- $where[] = ['is_gc', '=' ,1];
|
|
|
- }else{
|
|
|
- $where[] = ['is_gc', '=' ,0];
|
|
|
- }
|
|
|
- $list['warm'] = WaterMaterialScience::field('id,name,unit_price,company')->where('type', 7)->where($where)->select(); // 保温
|
|
|
- $list['channel'] = WaterMaterialScience::field('id,name,unit_price,company')->where('type', 8)->where($where)->select(); // 槽钢
|
|
|
- $list['roof'] = WaterMaterialScience::field('id,name,unit_price,company')->where('type', 1)->where($where)->select();// 顶板
|
|
|
- $list['side_plate'] = WaterMaterialScience::field('id,name,unit_price,company')->where('type', 2)->where($where)->select();// 侧板
|
|
|
- $list['lacing'] = WaterMaterialScience::field('id,name,unit_price,company')->where('type', 3)->where($where)->select();// 拉筋
|
|
|
- $list['floor'] = WaterMaterialScience::field('id,name,unit_price,company')->where('type', 4)->where($where)->select(); // 底板
|
|
|
- $list['column'] = WaterMaterialScience::field('id,name,unit_price,company')->where('type', 5)->where($where)->select(); // 立柱
|
|
|
- $list['fula'] = WaterMaterialScience::field('id,name,unit_price,company')->where('type', 6)->where($where)->select(); // 辅拉
|
|
|
+ $list['warm'] = WaterCate::field('id,name')->where('type', 7)->select(); // 保温
|
|
|
+ $list['channel'] = WaterCate::field('id,name')->where('type', 8)->select(); // 槽钢
|
|
|
+ $list['roof'] = WaterCate::field('id,name')->where('type', 1)->select();// 顶板
|
|
|
+ $list['side_plate'] = WaterCate::field('id,name')->where('type', 2)->select();// 侧板
|
|
|
+ $list['lacing'] = WaterCate::field('id,name')->where('type', 3)->select();// 拉筋
|
|
|
+ $list['floor'] = WaterCate::field('id,name')->where('type', 4)->select(); // 底板
|
|
|
+ $list['column'] = WaterCate::field('id,name')->where('type', 5)->select(); // 立柱
|
|
|
+ $list['fula'] = WaterCate::field('id,name')->where('type', 6)->select(); // 辅拉
|
|
|
|
|
|
return app('json')->success($list);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 计算记录
|
|
|
+ * @param Request $request
|
|
|
+ * @return mixed
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
+ * @throws \think\db\exception\DbException
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
+ */
|
|
|
+ public function query_list(Request $request)
|
|
|
+ {
|
|
|
+ $list = WaterQuery::where('uid', $request->uid())->select();
|
|
|
+ $list = count($list) > 0 ? $list->toArray(): [];
|
|
|
+ return app('json')->success($list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 计算详情
|
|
|
+ * @param Request $request
|
|
|
+ * @return mixed
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
+ * @throws \think\db\exception\DbException
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
+ */
|
|
|
+ public function query_details(Request $request)
|
|
|
+ {
|
|
|
+ $data = UtilService::getMore(['id']);
|
|
|
+ if (!$data['id']) return app('json')->fail('传入正确参数');
|
|
|
+
|
|
|
+ $list = WaterMaterial::where('query_id', $data['id'])->select();
|
|
|
+ return app('json')->success($list->toArray());
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|