|
|
@@ -77,23 +77,38 @@ class Task extends Backend
|
|
|
if (!empty($value[$i]['percentage'])) {//判断有没有材料和百分比
|
|
|
$list[$key][$i]['percentage'] = decode($value[$i]['percentage']);
|
|
|
//计算应加入的重量
|
|
|
- $list[$key][$i]['num'] = number_format($list[$key][$i]['percentage'] / $num * $task[$key]['number'],3);
|
|
|
+ $number = ceil($list[$key][$i]['percentage'] / $num * $task[$key]['number'] * 1000);
|
|
|
+ $list[$key][$i]['num'] = number_format($number/1000,3);
|
|
|
+ $list[$key][$i]['machine'] = $task[$key]['machine'];
|
|
|
+ $list[$key][$i]['str'] = '';//为汇总数组中机台做准备字段
|
|
|
array_push($res,$list[$key][$i]);//将数组push到新的需要整合的数组中
|
|
|
}else{
|
|
|
unset($list[$key][$i]);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
$list[$key] = array_values($list[$key]);
|
|
|
}
|
|
|
$result = $this->sumWeight($res,'material','num');
|
|
|
+ foreach ($list as $k=>$v){
|
|
|
+ $sum_list = $this->sumWeight($v,'material','num');
|
|
|
+ for ($i=0;$i<count($result);$i++){//循环汇总表
|
|
|
+ for ($j=0;$j<count($sum_list);$j++){
|
|
|
+ if ($result[$i]['material'] == $sum_list[$j]['material']){
|
|
|
+ if ( $result[$i]['str'] != $sum_list[$j]['machine']){
|
|
|
+ $result[$i]['str'] .= "<div>".$sum_list[$j]['machine'].":".$sum_list[$j]['num']."</div>";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
// echo "<pre>";
|
|
|
// print_r($task);//一维
|
|
|
// echo "</pre>";
|
|
|
//
|
|
|
// echo "<pre>";
|
|
|
-// print_r($list);//原材料信息
|
|
|
+// print_r($sum_list);//原材料信息
|
|
|
// echo "</pre>";
|
|
|
|
|
|
// echo "<pre>";
|