|
|
@@ -51,7 +51,7 @@ class Feeding extends Backend
|
|
|
return $this->view->fetch();
|
|
|
}
|
|
|
$params = $this->request->post('row/a');
|
|
|
-
|
|
|
+
|
|
|
$params = $this->preExcludeFields($params);
|
|
|
$tid = Db::name('task')->where('bach',$params['bach'])->order('id desc')->find();
|
|
|
$arr = [];
|
|
|
@@ -127,6 +127,7 @@ class Feeding extends Backend
|
|
|
->field('f.material,f.percentage,f.gy_name,f.gy_num,t.number,t.id')
|
|
|
->where('t.bach',$bach)->select();
|
|
|
}
|
|
|
+// print_r($res);die;
|
|
|
$pro = 0;
|
|
|
//按照百分比计算出应投重量
|
|
|
foreach($res as &$v){
|
|
|
@@ -148,8 +149,14 @@ class Feeding extends Backend
|
|
|
if($v['material'] == null){
|
|
|
$v['material'] = '';
|
|
|
}
|
|
|
+ $total = array_column($res,'percentage');
|
|
|
+ foreach ($total as $key=>$value){
|
|
|
+ $total[$key] = decode($value);
|
|
|
+ }
|
|
|
+ $num = array_sum($total);
|
|
|
if($v['percentage']){
|
|
|
- $v['nweight']=round($v['number']*decode($v['percentage'])/100,2);
|
|
|
+// $v['nweight']=round($v['number']*decode($v['percentage'])/100,2);
|
|
|
+ $v['nweight'] = number_format(decode($v['percentage']) / $num * $v['number'],3);
|
|
|
}else{
|
|
|
$v['nweight']='';
|
|
|
}
|