|
|
@@ -392,15 +392,15 @@ class OrderSuperLoss extends Api
|
|
|
$data['warehousing_num'] = $cp_data[0]['cp_sl'];
|
|
|
$data['warehousing_date'] = substr($cp_data[0]['jjcp_sj'],0,10);
|
|
|
//查出进入超节损的工序,有上报产量的工序就进入超节损
|
|
|
-// $gxh_sql = "SELECT sczl_gxh FROM
|
|
|
-// (SELECT sczl_gxh FROM 设备_产量计酬 WHERE sczl_gdbh = '{$order}' AND sczl_yjno = '{$params['yjno']}'
|
|
|
-// UNION SELECT sczl_gxh FROM db_sczl WHERE sczl_gdbh = '{$order}' AND sczl_yjno = '{$params['yjno']}') AS combined_result";
|
|
|
-// $gxh_arr = Db::query($gxh_sql);
|
|
|
- $gxh_arr = \db('工单_工艺资料')
|
|
|
- ->where('Gy0_gdbh',$order)
|
|
|
- ->where('Gy0_yjno',$params['yjno'])
|
|
|
- ->field('Gy0_gxh as sczl_gxh')
|
|
|
- ->select();
|
|
|
+ $gxh_sql = "SELECT sczl_gxh FROM
|
|
|
+ (SELECT sczl_gxh FROM 设备_产量计酬 WHERE sczl_gdbh = '{$order}' AND sczl_yjno = '{$params['yjno']}'
|
|
|
+ UNION SELECT sczl_gxh FROM db_sczl WHERE sczl_gdbh = '{$order}' AND sczl_yjno = '{$params['yjno']}') AS combined_result";
|
|
|
+ $gxh_arr = Db::query($gxh_sql);
|
|
|
+// $gxh_arr = \db('工单_工艺资料')
|
|
|
+// ->where('Gy0_gdbh',$order)
|
|
|
+// ->where('Gy0_yjno',$params['yjno'])
|
|
|
+// ->field('Gy0_gxh as sczl_gxh')
|
|
|
+// ->select();
|
|
|
$gxh_values = array_column($gxh_arr, 'sczl_gxh');
|
|
|
foreach ($gxh_values as $k=>$v){
|
|
|
if ((int)$v < 10){
|
|
|
@@ -451,7 +451,7 @@ class OrderSuperLoss extends Api
|
|
|
$out_sql = "SELECT fp_sl1,fp_sl2,fp_sl3,fp_sl4,fp_sl5,fp_sl6,fp_sl7,fp_sl8,fp_sl9,fp_sl10,fp_sl11,fp_sl12,fp_sl13,
|
|
|
fp_lb1,fp_lb2,fp_lb3,fp_lb4,fp_lb5,fp_lb6,fp_lb7,fp_lb8,fp_lb9,fp_lb10,fp_lb11,fp_lb12,fp_lb13,
|
|
|
fp_bh1,fp_bh2,fp_bh3,fp_bh4,fp_bh5,fp_bh6,fp_bh7,fp_bh8,fp_bh9,fp_bh10,fp_bh11,fp_bh12,fp_bh13,
|
|
|
- fp_gxmc1,fp_gxmc2,fp_gxmc3,fp_gxmc4,fp_gxmc5,fp_gxmc6,fp_gxmc7,fp_gxmc8,fp_gxmc9,fp_gxmc10,fp_gxmc11,fp_gxmc12,fp_gxmc13
|
|
|
+ fp_gxmc1,fp_gxmc2,fp_gxmc3,fp_gxmc4,fp_gxmc5,fp_gxmc6,fp_gxmc7,fp_gxmc8,fp_gxmc9,fp_gxmc10,fp_gxmc11,fp_gxmc12,fp_gxmc13,UniqId
|
|
|
FROM db_qczl WHERE qczl_gdbh = '{$order}' AND qczl_yjno = '{$params['yjno']}'";
|
|
|
$waste_out = Db::query($out_sql);
|
|
|
$list = []; //外发废数组
|
|
|
@@ -614,7 +614,6 @@ class OrderSuperLoss extends Api
|
|
|
$value['Gy0_计划损耗'] = $value['Gy0_计划损耗']*$value['Gy0_ls']*$value['Gy0_ks'];
|
|
|
//计算每道工序的计划损耗
|
|
|
foreach ($total_cl_data as $k=>$v){
|
|
|
-
|
|
|
//每道工序的总产量
|
|
|
$cl = $v['total_cl'] * $v['Gy0_ls'];
|
|
|
if (empty($cl)){
|
|
|
@@ -670,25 +669,25 @@ class OrderSuperLoss extends Api
|
|
|
}
|
|
|
//重新计算多班组同组长的质检废,质检废 = 班组产量 / 总产量 * 质检废
|
|
|
$totals = [];
|
|
|
- foreach ($gy_data as $item) {
|
|
|
- $sczl_bh1 = $item['sczl_bh1'];
|
|
|
- $total_cl = $item['total_cl'];
|
|
|
-
|
|
|
- if (isset($totals[$sczl_bh1])) {
|
|
|
- $totals[$sczl_bh1]['total'] += $total_cl;
|
|
|
- } else {
|
|
|
- $totals[$sczl_bh1] = ['total' => $total_cl, 'count' => 0];
|
|
|
- }
|
|
|
- $totals[$sczl_bh1]['count']++;
|
|
|
- }
|
|
|
+// foreach ($gy_data as $item) {
|
|
|
+// $sczl_bh1 = $item['sczl_bh1'];
|
|
|
+// $total_cl = $item['total_cl'];
|
|
|
+//
|
|
|
+// if (isset($totals[$sczl_bh1])) {
|
|
|
+// $totals[$sczl_bh1]['total'] += $total_cl;
|
|
|
+// } else {
|
|
|
+// $totals[$sczl_bh1] = ['total' => $total_cl, 'count' => 0];
|
|
|
+// }
|
|
|
+// $totals[$sczl_bh1]['count']++;
|
|
|
+// }
|
|
|
$i = 0;
|
|
|
foreach ($gy_data as &$item) {
|
|
|
$sczl_bh1 = $item['sczl_bh1'];
|
|
|
$total_cl = $item['total_cl'];
|
|
|
- $item['total'] = $totals[$sczl_bh1]['total'];
|
|
|
- if ($totals[$sczl_bh1]['count'] > 1) {
|
|
|
- $item['质检废'] = round($total_cl / $totals[$sczl_bh1]['total'] * $item['质检废']);
|
|
|
- }
|
|
|
+// $item['total'] = $totals[$sczl_bh1]['total'];
|
|
|
+// if ($totals[$sczl_bh1]['count'] > 1) {
|
|
|
+// $item['质检废'] = round($total_cl / $totals[$sczl_bh1]['total'] * $item['质检废']);
|
|
|
+// }
|
|
|
//节损数量
|
|
|
if ($item['无形损分摊'] > 0){
|
|
|
$total_waste = $item['质检废'] + $item['sczl_zcfp'] + $item['无形损分摊'];
|