|
|
@@ -95,14 +95,45 @@ class Decision extends Api
|
|
|
->group('sczl_bzdh')
|
|
|
->select();
|
|
|
foreach ($data['total'][$key] as $k=>$v){
|
|
|
- $day_total = db('设备_产量计酬')
|
|
|
- ->field('DATE(sczl_rq) as day, SUM(sczl_cl) as total_cl')
|
|
|
- ->where('sczl_rq','like',$mouth.'%')
|
|
|
- ->where('sczl_jtbh', $value['设备编号'])
|
|
|
- ->where('sczl_bzdh', $v['sczl_bzdh'])
|
|
|
+// $day_total = db('设备_产量计酬')
|
|
|
+// ->field('DATE(sczl_rq) as day, SUM(sczl_cl) as total_cl')
|
|
|
+// ->where('sczl_rq','like',$mouth.'%')
|
|
|
+// ->where('sczl_jtbh', $value['设备编号'])
|
|
|
+// ->where('sczl_bzdh', $v['sczl_bzdh'])
|
|
|
+// ->group('sczl_bzdh,day')
|
|
|
+// ->select();
|
|
|
+// $day_total = array_column($day_total, 'total_cl', 'day');
|
|
|
+// $data['total'][$key][$k]['day_total'] = $day_total;
|
|
|
+ $day_cl = \db('设备_产量计酬')
|
|
|
+ ->alias('a')
|
|
|
+ ->join('工单_印件资料 c','a.sczl_gdbh = c.Yj_Gdbh AND a.sczl_yjno = c.yj_Yjno')
|
|
|
+ ->join('工单_工艺资料 d','a.sczl_gdbh = d.Gy0_gdbh AND a.sczl_yjno = d.Gy0_yjno AND a.sczl_gxh = d.Gy0_gxh')
|
|
|
+ ->field([
|
|
|
+ 'a.sczl_gdbh' => '工单编号',
|
|
|
+ 'a.sczl_yjno' => '印件号',
|
|
|
+ 'a.sczl_gxh' => '工序号',
|
|
|
+ 'c.yj_yjmc' => '印件名称',
|
|
|
+ 'CONCAT(d.Gy0_gxmc,"(",d.Add_gxmc,")")' => '工序名称',
|
|
|
+ 'DATE(a.sczl_rq)' => 'day',
|
|
|
+ 'a.sczl_jtbh' => '机台编号',
|
|
|
+ 'a.sczl_bzdh' => '班组编号',
|
|
|
+ 'SUM(a.sczl_cl)' => 'total_cl',
|
|
|
+ 'a.sczl_ms' => '墨色数',
|
|
|
+ 'rtrim(d.印刷方式)' => '印刷方式',
|
|
|
+ 'rtrim(d.版距)' => '版距'
|
|
|
+ ])
|
|
|
+ ->where('a.sczl_rq','like',$mouth.'%')
|
|
|
+ ->where('a.sczl_jtbh', $value['设备编号'])
|
|
|
+ ->where('a.sczl_bzdh', $v['sczl_bzdh'])
|
|
|
->group('sczl_bzdh,day')
|
|
|
->select();
|
|
|
- $day_total = array_column($day_total, 'total_cl', 'day');
|
|
|
+ $day_total = [];
|
|
|
+ foreach ($day_cl as $index=>$item){
|
|
|
+ if ($item['印刷方式'] === '卷对卷'){
|
|
|
+ $day_cl[$index]['total_cl'] = round($item['total_cl']/$item['版距']*1000);
|
|
|
+ }
|
|
|
+ $day_total[$item['day']] =$day_cl[$index]['total_cl'];
|
|
|
+ }
|
|
|
$data['total'][$key][$k]['day_total'] = $day_total;
|
|
|
}
|
|
|
}
|
|
|
@@ -149,10 +180,12 @@ class Decision extends Api
|
|
|
'a.sczl_jtbh' => '机台编号',
|
|
|
'a.sczl_bzdh' => '班组编号',
|
|
|
'SUM(a.sczl_cl)' => '产量',
|
|
|
- 'a.sczl_ms' => '墨色数'
|
|
|
+ 'a.sczl_ms' => '墨色数',
|
|
|
+ 'rtrim(d.印刷方式)' => '印刷方式',
|
|
|
+ 'rtrim(d.版距)' => '版距'
|
|
|
])
|
|
|
->where($where)
|
|
|
- ->group('a.sczl_gdbh,a.sczl_yjno,a.sczl_gxh')
|
|
|
+ ->group('a.sczl_gdbh,a.sczl_yjno,a.sczl_gxh,a.sczl_rq')
|
|
|
->order('工作日期')
|
|
|
->select();
|
|
|
if (!empty($list)){
|
|
|
@@ -160,6 +193,9 @@ class Decision extends Api
|
|
|
$list[$key]['印件名称'] = $value['印件号'].'-'.$value['印件名称'];
|
|
|
$list[$key]['工序名称'] = $value['工序号'].'-'.$value['工序名称'];
|
|
|
unset($list[$key]['印件号'],$list[$key]['工序号']);
|
|
|
+ if ($value['印刷方式'] === '卷对卷'){
|
|
|
+ $list[$key]['产量'] = round($value['产量']/$value['版距']*1000);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
$this->success('成功',$list);
|
|
|
@@ -183,27 +219,31 @@ class Decision extends Api
|
|
|
}
|
|
|
$where = [];
|
|
|
if(!empty($param['sist'])){
|
|
|
- $where['设备编组'] = $param['sist'];
|
|
|
+ $where['a.设备编组'] = $param['sist'];
|
|
|
}
|
|
|
//将参数装换成标准日期格式
|
|
|
$mouth = date_create_from_format('Ym', $param['mouth'])->format('Y-m');
|
|
|
$list = \db('设备_基本资料')
|
|
|
->alias('a')
|
|
|
- ->join('设备_产量计酬 b','a.设备编号 = b.sczl_jtbh')
|
|
|
+ ->join('设备_产量计酬 b', 'a.设备编号 = b.sczl_jtbh')
|
|
|
+ ->join('工单_印件资料 c', 'b.sczl_gdbh = c.Yj_Gdbh AND b.sczl_yjno = c.yj_Yjno')
|
|
|
+ ->join('工单_工艺资料 d', 'b.sczl_gdbh = d.Gy0_gdbh AND b.sczl_yjno = d.Gy0_yjno AND b.sczl_gxh = d.Gy0_gxh')
|
|
|
->field([
|
|
|
'a.设备编号' => '设备编号',
|
|
|
'rtrim(a.设备名称)' => '设备名称',
|
|
|
- 'SUM(b.sczl_cl)' => '产量',
|
|
|
+ 'SUM(CASE WHEN rtrim(d.版距) = "卷对卷" THEN b.sczl_cl / NULLIF(d.版距, 0) * 1000 ELSE b.sczl_cl END) AS 产量',
|
|
|
'SUM(b.sczl_设备运行工时)' => '设备运行工时',
|
|
|
'SUM(b.sczl_保养工时)' => '保养工时',
|
|
|
'SUM(b.sczl_打样总工时)' => '打样总工时',
|
|
|
'SUM(b.sczl_打样工时)' => '打样补产工时',
|
|
|
- 'SUM(b.sczl_装版总工时)' => '装板总工时',
|
|
|
+ 'SUM(b.sczl_装版总工时)' => '装版总工时',
|
|
|
'SUM(b.sczl_装版工时)' => '装板补产工时',
|
|
|
- 'SUM(b.sczl_异常停机工时)' => '异常停机工时'
|
|
|
+ 'SUM(b.sczl_异常停机工时)' => '异常停机工时',
|
|
|
+ 'rtrim(d.印刷方式)' => '印刷方式',
|
|
|
+ 'rtrim(d.版距)' => '版距'
|
|
|
])
|
|
|
->where($where)
|
|
|
- ->whereTime('b.sczl_rq',$mouth)
|
|
|
+ ->whereTime('b.sczl_rq', $mouth)
|
|
|
->group('a.设备编号')
|
|
|
->order('a.设备编号')
|
|
|
->select();
|
|
|
@@ -270,16 +310,21 @@ class Decision extends Api
|
|
|
'SUM(a.sczl_装版总工时)' => '装板总工时',
|
|
|
'SUM(a.sczl_装版工时)' => '装板补产工时',
|
|
|
'SUM(a.sczl_异常停机工时)' => '异常停机工时',
|
|
|
- 'a.sczl_ms' => '墨色数'
|
|
|
+ 'a.sczl_ms' => '墨色数',
|
|
|
+ 'rtrim(d.印刷方式)' => '印刷方式',
|
|
|
+ 'rtrim(d.版距)' => '版距'
|
|
|
])
|
|
|
->where($where)
|
|
|
- ->group('a.sczl_rq,a.sczl_gdbh')
|
|
|
+ ->group('a.sczl_rq,a.sczl_gdbh,a.sczl_rq')
|
|
|
->order('a.sczl_rq')
|
|
|
->select();
|
|
|
if (!empty($list)){
|
|
|
foreach ($list as $key=>$value){
|
|
|
$list[$key]['工序名称'] = $value['印件号'].'-'.$value['工序号'].'-'.$value['工序名称'];
|
|
|
unset($list[$key]['印件号'],$list[$key]['工序号']);
|
|
|
+ if ($value['印刷方式'] === '卷对卷'){
|
|
|
+ $list[$key]['产量'] = round($value['产量']/$value['版距']*1000);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
$this->success('成功',$list);
|