|
@@ -30,12 +30,19 @@ class Facility extends Api
|
|
|
if ($this->request->isGet() === false){
|
|
if ($this->request->isGet() === false){
|
|
|
$this->error('请求错误');
|
|
$this->error('请求错误');
|
|
|
}
|
|
}
|
|
|
|
|
+ $param = $this->request->param();
|
|
|
|
|
+ if (isset($param['sort'])){
|
|
|
|
|
+ $where['使用部门'] = '智能车间';
|
|
|
|
|
+ }else{
|
|
|
|
|
+ $where['使用部门'] = ['in',['印刷车间','印后车间']];
|
|
|
|
|
+ }
|
|
|
$data = [];
|
|
$data = [];
|
|
|
$date = date('Y-m-d 00:00:00',time()-3888000);
|
|
$date = date('Y-m-d 00:00:00',time()-3888000);
|
|
|
$department = \db('设备_基本资料')
|
|
$department = \db('设备_基本资料')
|
|
|
->distinct(true)
|
|
->distinct(true)
|
|
|
->where('使用部门','<>','研发中心')
|
|
->where('使用部门','<>','研发中心')
|
|
|
->where('设备编组','<>','')
|
|
->where('设备编组','<>','')
|
|
|
|
|
+ ->where($where)
|
|
|
->order('设备编组')
|
|
->order('设备编组')
|
|
|
->column('rtrim(使用部门) as 使用部门');
|
|
->column('rtrim(使用部门) as 使用部门');
|
|
|
if (empty($department)){
|
|
if (empty($department)){
|
|
@@ -147,10 +154,16 @@ class Facility extends Api
|
|
|
if ($value['yjno']<10){
|
|
if ($value['yjno']<10){
|
|
|
$list[$key]['yjno'] = '0'.$value['yjno'];
|
|
$list[$key]['yjno'] = '0'.$value['yjno'];
|
|
|
}
|
|
}
|
|
|
- $row = \db('dic_lzde')->where('sys_bh',$value['定额代号'])->field('rtrim(千件工价) as 千件工价,rtrim(日定额) as 日定额,rtrim(补产标准) as 补产标准')->find();
|
|
|
|
|
- $list[$key]['千件工价'] = $row['千件工价'];
|
|
|
|
|
- $list[$key]['日定额'] = $row['日定额'];
|
|
|
|
|
- $list[$key]['补产标准'] = $row['补产标准'];
|
|
|
|
|
|
|
+ if (empty($value['定额代号'])){
|
|
|
|
|
+ $list[$key]['千件工价'] = '';
|
|
|
|
|
+ $list[$key]['日定额'] = '';
|
|
|
|
|
+ $list[$key]['补产标准'] = '';
|
|
|
|
|
+ }else{
|
|
|
|
|
+ $row = \db('dic_lzde')->where('sys_bh',$value['定额代号'])->field('rtrim(千件工价) as 千件工价,rtrim(日定额) as 日定额,rtrim(补产标准) as 补产标准')->find();
|
|
|
|
|
+ $list[$key]['千件工价'] = $row['千件工价'];
|
|
|
|
|
+ $list[$key]['日定额'] = $row['日定额'];
|
|
|
|
|
+ $list[$key]['补产标准'] = $row['补产标准'];
|
|
|
|
|
+ }
|
|
|
$list[$key]['工序'] = $list[$key]['yjno'].'-'.$list[$key]['gxmc'];
|
|
$list[$key]['工序'] = $list[$key]['yjno'].'-'.$list[$key]['gxmc'];
|
|
|
$list[$key]['备注'] = $value['bzdh'].'('.$value['num'].')'.date('H:i',strtotime($value['sj1'])).'<-->'.date('H:i',strtotime($value['sj2']));
|
|
$list[$key]['备注'] = $value['bzdh'].'('.$value['num'].')'.date('H:i',strtotime($value['sj1'])).'<-->'.date('H:i',strtotime($value['sj2']));
|
|
|
for ($i=1;$i<11;$i++){
|
|
for ($i=1;$i<11;$i++){
|
|
@@ -263,25 +276,22 @@ class Facility extends Api
|
|
|
$machine = $params['machine'];
|
|
$machine = $params['machine'];
|
|
|
$machineCode = \db('dic_lzde')->where('适用机型',$machine)->value('sys_bh');
|
|
$machineCode = \db('dic_lzde')->where('适用机型',$machine)->value('sys_bh');
|
|
|
$data = \db('设备_产量采集')->where('设备编号',$machine)->order('UniqId desc')->find();
|
|
$data = \db('设备_产量采集')->where('设备编号',$machine)->order('UniqId desc')->find();
|
|
|
- if (empty($data['工单编号'])){
|
|
|
|
|
- $this->success('未找到生产订单');
|
|
|
|
|
- }
|
|
|
|
|
- $endTime = \db('工单_工艺资料')
|
|
|
|
|
- ->where('UniqId',$data['任务ID'])
|
|
|
|
|
-// ->where('Gy0_sj1','>','1900-01-01 00:00:00')
|
|
|
|
|
- ->find();
|
|
|
|
|
- if (empty($endTime)){
|
|
|
|
|
- $this->error('未找到');
|
|
|
|
|
- }
|
|
|
|
|
$list = [];
|
|
$list = [];
|
|
|
- if ($endTime['PD_WG'] === '1900-01-01 00:00:00'){
|
|
|
|
|
|
|
+ if (!empty($data['工单编号'])){
|
|
|
|
|
+ $endTime = \db('工单_工艺资料')
|
|
|
|
|
+ ->where('UniqId',$data['任务ID'])
|
|
|
|
|
+ ->find();
|
|
|
$list['工单编号'] = $data['工单编号'];
|
|
$list['工单编号'] = $data['工单编号'];
|
|
|
- $list['印件号'] = $data['印件号'];
|
|
|
|
|
- $name = \db('工单_基本资料')->where('Gd_Gdbh',$data['工单编号'])->value('成品名称');
|
|
|
|
|
- $code = \db('工单_基本资料')->where('Gd_Gdbh',$data['工单编号'])->value('成品代号');
|
|
|
|
|
- $list['产品名称'] = rtrim($name);
|
|
|
|
|
- $list['产品代号'] = rtrim($code);
|
|
|
|
|
- $list['工序名称'] = $data['工序名称'];
|
|
|
|
|
|
|
+ if (!empty($endTime)){
|
|
|
|
|
+ if ($endTime['PD_WG'] === '1900-01-01 00:00:00'){
|
|
|
|
|
+ $list['印件号'] = $data['印件号'];
|
|
|
|
|
+ $name = \db('工单_基本资料')->where('Gd_Gdbh',$data['工单编号'])->value('成品名称');
|
|
|
|
|
+ $code = \db('工单_基本资料')->where('Gd_Gdbh',$data['工单编号'])->value('成品代号');
|
|
|
|
|
+ $list['产品名称'] = rtrim($name);
|
|
|
|
|
+ $list['产品代号'] = rtrim($code);
|
|
|
|
|
+ $list['工序名称'] = $data['工序名称'];
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}else{
|
|
}else{
|
|
|
$list['工单编号'] = '';
|
|
$list['工单编号'] = '';
|
|
|
$list['印件号'] = 0;
|
|
$list['印件号'] = 0;
|
|
@@ -295,20 +305,19 @@ class Facility extends Api
|
|
|
$class = \db('设备_班组资料')->where('UniqId',$data['班组ID'])->field("rtrim(sczl_bh1) as bh1,rtrim(sczl_bh2) as bh2,rtrim(sczl_bh3) as bh3,rtrim(sczl_bh4) as bh4,
|
|
$class = \db('设备_班组资料')->where('UniqId',$data['班组ID'])->field("rtrim(sczl_bh1) as bh1,rtrim(sczl_bh2) as bh2,rtrim(sczl_bh3) as bh3,rtrim(sczl_bh4) as bh4,
|
|
|
rtrim(sczl_bh5) as bh5,rtrim(sczl_bh6) as bh6,rtrim(sczl_bh7) as bh7,rtrim(sczl_bh8) as bh8,rtrim(sczl_bh9) as bh9,
|
|
rtrim(sczl_bh5) as bh5,rtrim(sczl_bh6) as bh6,rtrim(sczl_bh7) as bh7,rtrim(sczl_bh8) as bh8,rtrim(sczl_bh9) as bh9,
|
|
|
rtrim(sczl_bh10) as bh10")->find();
|
|
rtrim(sczl_bh10) as bh10")->find();
|
|
|
- if (empty($class)){
|
|
|
|
|
- $this->success('未找到班组信息');
|
|
|
|
|
- }
|
|
|
|
|
$row = [];
|
|
$row = [];
|
|
|
- for ($i=1;$i<11;$i++) {
|
|
|
|
|
- if ($class['bh' . $i] != '' && $class['bh' . $i] != '000000') {
|
|
|
|
|
- $name = \db('人事_基本资料')->where('员工编号', $class['bh' . $i])->field('rtrim(员工姓名) as 姓名')->find();
|
|
|
|
|
- $row[$i] = [
|
|
|
|
|
- '编号' => $class['bh' . $i],
|
|
|
|
|
- '姓名' => $name['姓名']
|
|
|
|
|
- ];
|
|
|
|
|
|
|
+ if (!empty($class)){
|
|
|
|
|
+ for ($i=1;$i<11;$i++) {
|
|
|
|
|
+ if ($class['bh' . $i] != '' && $class['bh' . $i] != '000000') {
|
|
|
|
|
+ $name = \db('人事_基本资料')->where('员工编号', $class['bh' . $i])->field('rtrim(员工姓名) as 姓名')->find();
|
|
|
|
|
+ $row[$i] = [
|
|
|
|
|
+ '编号' => $class['bh' . $i],
|
|
|
|
|
+ '姓名' => $name['姓名']
|
|
|
|
|
+ ];
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+ $row = array_values($row);
|
|
|
}
|
|
}
|
|
|
- $row = array_values($row);
|
|
|
|
|
$list['班组成员'] = $row;
|
|
$list['班组成员'] = $row;
|
|
|
$list['定额代号'] = $machineCode;
|
|
$list['定额代号'] = $machineCode;
|
|
|
$this->success('成功',$list);
|
|
$this->success('成功',$list);
|
|
@@ -369,32 +378,31 @@ class Facility extends Api
|
|
|
GROUP BY a.Gy0_gdbh,a.Gy0_yjno,a.Gy0_gxh
|
|
GROUP BY a.Gy0_gdbh,a.Gy0_yjno,a.Gy0_gxh
|
|
|
ORDER BY a.UniqId desc";
|
|
ORDER BY a.UniqId desc";
|
|
|
$orderList = Db::query($sql);
|
|
$orderList = Db::query($sql);
|
|
|
- if (empty($orderList)){
|
|
|
|
|
- $this->success('未找到排产工单');
|
|
|
|
|
- }
|
|
|
|
|
- $data = \db('设备_产量采集')->where('设备编号',$machine)->order('UniqId desc')->find();
|
|
|
|
|
- foreach ($orderList as $key=>$value){
|
|
|
|
|
- $orderList[$key]['status'] = 0;
|
|
|
|
|
- if (!empty($data)){
|
|
|
|
|
- if ($value['gdbh'] === $data['工单编号'] && $value['yjno'] === $data['印件号'] && $value['gxh'] === $data['工序号']) {
|
|
|
|
|
- $orderList[$key]['status'] = 1;
|
|
|
|
|
|
|
+ if (!empty($orderList)){
|
|
|
|
|
+ $data = \db('设备_产量采集')->where('设备编号',$machine)->order('UniqId desc')->find();
|
|
|
|
|
+ foreach ($orderList as $key=>$value){
|
|
|
|
|
+ $orderList[$key]['status'] = 0;
|
|
|
|
|
+ if (!empty($data)){
|
|
|
|
|
+ if ($value['gdbh'] === $data['工单编号'] && $value['yjno'] === $data['印件号'] && $value['gxh'] === $data['工序号']) {
|
|
|
|
|
+ $orderList[$key]['status'] = 1;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
- $orderList[$key]['工单编号|质量信息'] = $value['gdbh'].'|'.$value['质量信息'];
|
|
|
|
|
- $orderList[$key]['印件号'] = $value['yjno'];
|
|
|
|
|
- $orderList[$key]['工序号'] = $value['gxh'];
|
|
|
|
|
- if ($value['yjno']<10){
|
|
|
|
|
- $orderList[$key]['yjno'] = '0'.$value['yjno'];
|
|
|
|
|
- }
|
|
|
|
|
- if ($value['gxh']<10){
|
|
|
|
|
- $orderList[$key]['gxh'] = '0'.$value['gxh'];
|
|
|
|
|
|
|
+ $orderList[$key]['工单编号|质量信息'] = $value['gdbh'].'|'.$value['质量信息'];
|
|
|
|
|
+ $orderList[$key]['印件号'] = $value['yjno'];
|
|
|
|
|
+ $orderList[$key]['工序号'] = $value['gxh'];
|
|
|
|
|
+ if ($value['yjno']<10){
|
|
|
|
|
+ $orderList[$key]['yjno'] = '0'.$value['yjno'];
|
|
|
|
|
+ }
|
|
|
|
|
+ if ($value['gxh']<10){
|
|
|
|
|
+ $orderList[$key]['gxh'] = '0'.$value['gxh'];
|
|
|
|
|
+ }
|
|
|
|
|
+ $orderList[$key]['印件资料'] = $orderList[$key]['yjno'].'-'.$value['印件名称'];
|
|
|
|
|
+ $orderList[$key]['工序名称'] = $orderList[$key]['gxh'].'-'.$value['gxmc'].'【'.$value['add_gxmc'].'】';
|
|
|
|
|
+ $orderList[$key]['计划产量/已完成'] = (int)$value['计划接货数'].'/'.$value['已完成']=null?'':(int)$value['已完成'];
|
|
|
|
|
+ $orderList[$key]['计划生产时段'] =substr($value['sj1'],5,5).' '.substr($value['sj1'],11,5).'<-->'.substr($value['sj2'],5,5).' '.substr($value['sj2'],11,5);
|
|
|
|
|
+ unset($orderList[$key]['gdbh'],$orderList[$key]['质量信息'],$orderList[$key]['gxh'],$orderList[$key]['yjno'],$orderList[$key]['gxmc'],$orderList[$key]['add_gxmc'],$orderList[$key]['计划接货数'],$orderList[$key]['已完成'],$orderList[$key]['印件名称'],$orderList[$key]['ls']);
|
|
|
}
|
|
}
|
|
|
- $orderList[$key]['印件资料'] = $orderList[$key]['yjno'].'-'.$value['印件名称'];
|
|
|
|
|
- $orderList[$key]['工序名称'] = $orderList[$key]['gxh'].'-'.$value['gxmc'].'【'.$value['add_gxmc'].'】';
|
|
|
|
|
- $orderList[$key]['计划产量/已完成'] = (int)$value['计划接货数'].'/'.$value['已完成']=null?'':(int)$value['已完成'];
|
|
|
|
|
- $orderList[$key]['计划生产时段'] =substr($value['sj1'],5,5).' '.substr($value['sj1'],11,5).'<-->'.substr($value['sj2'],5,5).' '.substr($value['sj2'],11,5);
|
|
|
|
|
- unset($orderList[$key]['gdbh'],$orderList[$key]['质量信息'],$orderList[$key]['gxh'],$orderList[$key]['yjno'],$orderList[$key]['gxmc'],$orderList[$key]['add_gxmc'],$orderList[$key]['计划接货数'],$orderList[$key]['已完成'],$orderList[$key]['印件名称'],$orderList[$key]['ls']);
|
|
|
|
|
}
|
|
}
|
|
|
$this->success('成功',$orderList);
|
|
$this->success('成功',$orderList);
|
|
|
}
|
|
}
|
|
@@ -417,28 +425,27 @@ class Facility extends Api
|
|
|
$this->error('请求错误');
|
|
$this->error('请求错误');
|
|
|
}
|
|
}
|
|
|
$workOrder = input('Gd_gdbh');
|
|
$workOrder = input('Gd_gdbh');
|
|
|
- if (empty($workOrder)){
|
|
|
|
|
- $this->error('参数错误');
|
|
|
|
|
- }
|
|
|
|
|
- //右边工艺及完成数量
|
|
|
|
|
- $Process = \db('设备_产量计酬')->where('sczl_gdbh',$workOrder)
|
|
|
|
|
- ->distinct(true)->order('sczl_gxh')
|
|
|
|
|
- ->column('sczl_gxh');
|
|
|
|
|
$data = [];
|
|
$data = [];
|
|
|
- foreach ($Process as $k=>$v){
|
|
|
|
|
- $res= \db('设备_产量计酬')->where('sczl_gdbh',$workOrder)
|
|
|
|
|
- ->where('sczl_gxh',$v)
|
|
|
|
|
- ->field('rtrim(sczl_yjno) as sczl_yjno,rtrim(sczl_gxmc) as sczl_gxmc')
|
|
|
|
|
- ->find();
|
|
|
|
|
- if ($res['sczl_yjno']<10){
|
|
|
|
|
- $res['sczl_yjno'] = '0'.$res['sczl_yjno'];
|
|
|
|
|
|
|
+ if (!empty($workOrder)){
|
|
|
|
|
+ //右边工艺及完成数量
|
|
|
|
|
+ $Process = \db('设备_产量计酬')->where('sczl_gdbh',$workOrder)
|
|
|
|
|
+ ->distinct(true)->order('sczl_gxh')
|
|
|
|
|
+ ->column('sczl_gxh');
|
|
|
|
|
+ foreach ($Process as $k=>$v){
|
|
|
|
|
+ $res= \db('设备_产量计酬')->where('sczl_gdbh',$workOrder)
|
|
|
|
|
+ ->where('sczl_gxh',$v)
|
|
|
|
|
+ ->field('rtrim(sczl_yjno) as sczl_yjno,rtrim(sczl_gxmc) as sczl_gxmc')
|
|
|
|
|
+ ->find();
|
|
|
|
|
+ if ($res['sczl_yjno']<10){
|
|
|
|
|
+ $res['sczl_yjno'] = '0'.$res['sczl_yjno'];
|
|
|
|
|
+ }
|
|
|
|
|
+ $processList['process'] = $res['sczl_yjno'].'-'.$res['sczl_gxmc'];
|
|
|
|
|
+ $processList['completed'] = \db('设备_产量计酬')
|
|
|
|
|
+ ->where('sczl_gdbh',$workOrder)
|
|
|
|
|
+ ->where('sczl_gxh',$v)
|
|
|
|
|
+ ->count();
|
|
|
|
|
+ array_push($data,$processList);
|
|
|
}
|
|
}
|
|
|
- $processList['process'] = $res['sczl_yjno'].'-'.$res['sczl_gxmc'];
|
|
|
|
|
- $processList['completed'] = \db('设备_产量计酬')
|
|
|
|
|
- ->where('sczl_gdbh',$workOrder)
|
|
|
|
|
- ->where('sczl_gxh',$v)
|
|
|
|
|
- ->count();
|
|
|
|
|
- array_push($data,$processList);
|
|
|
|
|
}
|
|
}
|
|
|
$this->success('成功',$data);
|
|
$this->success('成功',$data);
|
|
|
}
|
|
}
|
|
@@ -541,34 +548,35 @@ class Facility extends Api
|
|
|
rtrim(码开始行) as 码开始行,rtrim(码结束行) as 码结束行,rtrim(码包) as 码包,rtrim(主电表) as 主电表,rtrim(辅电表) as 辅电表,rtrim(sczl_ms) as 色度,
|
|
rtrim(码开始行) as 码开始行,rtrim(码结束行) as 码结束行,rtrim(码包) as 码包,rtrim(主电表) as 主电表,rtrim(辅电表) as 辅电表,rtrim(sczl_ms) as 色度,
|
|
|
rtrim(sczl_sj1) as sj1,rtrim(sczl_sj2) as sj2,rtrim(UniqId) as UniqId,rtrim(sczl_bh98) as 拉料,rtrim(sczl_ls) as ls';
|
|
rtrim(sczl_sj1) as sj1,rtrim(sczl_sj2) as sj2,rtrim(UniqId) as UniqId,rtrim(sczl_bh98) as 拉料,rtrim(sczl_ls) as ls';
|
|
|
$list = \db('设备_产量计酬')->where($where)->field($field)->order('UniqId desc')->select();
|
|
$list = \db('设备_产量计酬')->where($where)->field($field)->order('UniqId desc')->select();
|
|
|
- if (empty($list)){
|
|
|
|
|
- $this->success('');
|
|
|
|
|
- }
|
|
|
|
|
- foreach ($list as $k=>$v){
|
|
|
|
|
- $name = \db('工单_基本资料')->where('Gd_gdbh',$v['工单编号'])->where('行号',$v['yjno'])->field('rtrim(Gd_cpmc) as productName,rtrim(成品名称) as 成品名称')->find();
|
|
|
|
|
- if ($v['yjno']<10){
|
|
|
|
|
- $list[$k]['yjno'] = '0'.$v['yjno'];
|
|
|
|
|
- }
|
|
|
|
|
- if (!empty($v['拉料'])){
|
|
|
|
|
- $list[$k]['拉料姓名'] = \db('人事_基本资料')->where('员工编号',$v['拉料'])->value('rtrim(员工姓名) as 员工姓名');
|
|
|
|
|
- }
|
|
|
|
|
- if (isset($list[$k]['拉料姓名']) === false){
|
|
|
|
|
- $list[$k]['拉料姓名'] = '';
|
|
|
|
|
- }
|
|
|
|
|
- $list[$k]['印件及工序'] = $list[$k]['yjno'].'-'.$v['gxmc'];
|
|
|
|
|
- $list[$k]['生产时间段'] = substr($v['sj1'],5,5).' '.substr($v['sj1'],11,5).'<-->'.substr($v['sj2'],5,5).' '.substr($v['sj2'],11,5);
|
|
|
|
|
- $list[$k]['产品名称'] = $name['productName'];
|
|
|
|
|
- if (empty($name['productName'])){
|
|
|
|
|
- $list[$k]['产品名称'] = $name['成品名称'];
|
|
|
|
|
|
|
+ if (!empty($list)){
|
|
|
|
|
+ foreach ($list as $k=>$v){
|
|
|
|
|
+ $name = \db('工单_基本资料')->where('Gd_gdbh',$v['工单编号'])->where('行号',$v['yjno'])->field('rtrim(Gd_cpmc) as productName,rtrim(成品名称) as 成品名称')->find();
|
|
|
|
|
+ if ($v['yjno']<10){
|
|
|
|
|
+ $list[$k]['yjno'] = '0'.$v['yjno'];
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!empty($v['拉料'])){
|
|
|
|
|
+ $list[$k]['拉料姓名'] = \db('人事_基本资料')->where('员工编号',$v['拉料'])->value('rtrim(员工姓名) as 员工姓名');
|
|
|
|
|
+ }
|
|
|
|
|
+ if (isset($list[$k]['拉料姓名']) === false){
|
|
|
|
|
+ $list[$k]['拉料姓名'] = '';
|
|
|
|
|
+ }
|
|
|
|
|
+ $list[$k]['印件及工序'] = $list[$k]['yjno'].'-'.$v['gxmc'];
|
|
|
|
|
+ $list[$k]['生产时间段'] = substr($v['sj1'],5,5).' '.substr($v['sj1'],11,5).'<-->'.substr($v['sj2'],5,5).' '.substr($v['sj2'],11,5);
|
|
|
|
|
+ $list[$k]['产品名称'] = $name['productName'];
|
|
|
|
|
+ if (empty($name['productName'])){
|
|
|
|
|
+ $list[$k]['产品名称'] = $name['成品名称'];
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- $field1 = 'SUM(sczl_cl) as 产量,SUM(sczl_zcfp) as 制程废品,SUM(sczl_zccp) as 制程次品,SUM(sczl_前工序废) as 前工序废,
|
|
|
|
|
|
|
+ $field1 = 'SUM(sczl_cl) as 产量,SUM(sczl_zcfp) as 制程废品,SUM(sczl_zccp) as 制程次品,SUM(sczl_前工序废) as 前工序废,
|
|
|
SUM(sczl_来料少数) as 来料异常,SUM(sczl_装版工时) as 装版工时,SUM(sczl_保养工时) as 保养工时,SUM(sczl_打样工时) as 打样工时,
|
|
SUM(sczl_来料少数) as 来料异常,SUM(sczl_装版工时) as 装版工时,SUM(sczl_保养工时) as 保养工时,SUM(sczl_打样工时) as 打样工时,
|
|
|
SUM(sczl_异常停机工时) as 异常停机工时,SUM(sczl_设备运行工时) as 通电工时,SUM(码开始行) as 码开始行,SUM(码结束行) as 码结束行,
|
|
SUM(sczl_异常停机工时) as 异常停机工时,SUM(sczl_设备运行工时) as 通电工时,SUM(码开始行) as 码开始行,SUM(码结束行) as 码结束行,
|
|
|
SUM(码包) as 码包,SUM(主电表) as 主电表,SUM(辅电表) as 辅电表';
|
|
SUM(码包) as 码包,SUM(主电表) as 主电表,SUM(辅电表) as 辅电表';
|
|
|
- $total = \db('设备_产量计酬')->where($where)->field($field1)->order('UniqId desc')->select();
|
|
|
|
|
- $total[0]['版数'] = count($list);
|
|
|
|
|
- $list['total'] = $total[0];
|
|
|
|
|
|
|
+ $total = \db('设备_产量计酬')->where($where)->field($field1)->order('UniqId desc')->select();
|
|
|
|
|
+ $total[0]['版数'] = count($list);
|
|
|
|
|
+ $list['total'] = $total[0];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
$this->success('成功',$list);
|
|
$this->success('成功',$list);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -718,7 +726,17 @@ class Facility extends Api
|
|
|
if (empty($param)){
|
|
if (empty($param)){
|
|
|
$this->error('参数错误');
|
|
$this->error('参数错误');
|
|
|
}
|
|
}
|
|
|
- $res = \db('设备_班组资料')
|
|
|
|
|
|
|
+ $machine = \db('设备_班组资料')
|
|
|
|
|
+ ->where('UniqId',$param['UniqId'])
|
|
|
|
|
+ ->value('sczl_jtbh');
|
|
|
|
|
+ $teamId = \db('设备_产量采集')
|
|
|
|
|
+ ->where('设备编号',$machine)
|
|
|
|
|
+ ->order('UniqId desc')
|
|
|
|
|
+ ->value('班组ID');
|
|
|
|
|
+ if ($teamId === (int)$param['UniqId']){
|
|
|
|
|
+ $this->success('无法删除正在生产的班组资料,请先切换班组');
|
|
|
|
|
+ }
|
|
|
|
|
+ $res = \db('设备_班组资料')
|
|
|
->where('UniqId',$param['UniqId'])
|
|
->where('UniqId',$param['UniqId'])
|
|
|
->delete();
|
|
->delete();
|
|
|
if ($res !== false){
|
|
if ($res !== false){
|
|
@@ -1613,18 +1631,14 @@ class Facility extends Api
|
|
|
$lastData = \db('设备_产量采集')
|
|
$lastData = \db('设备_产量采集')
|
|
|
->order('UniqId desc')
|
|
->order('UniqId desc')
|
|
|
->find();
|
|
->find();
|
|
|
- if (empty($lastData)){
|
|
|
|
|
- $id = 1;
|
|
|
|
|
- }else{
|
|
|
|
|
- $id = $lastData['UniqId']+1;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ $id = $lastData['UniqId']+1;
|
|
|
$data['当前状态'] = $params['status'];
|
|
$data['当前状态'] = $params['status'];
|
|
|
$data['时间'] = date('Y-m-d H:i:s');
|
|
$data['时间'] = date('Y-m-d H:i:s');
|
|
|
$data['设备编号'] = $machine;
|
|
$data['设备编号'] = $machine;
|
|
|
- $data['工单编号'] = $params['order'];
|
|
|
|
|
- $data['印件号'] = $params['yjno'];
|
|
|
|
|
- $data['工序号'] = (int)substr($params['gy_name'], 0, 2);
|
|
|
|
|
- $data['工序名称'] = $params['gy_name'];
|
|
|
|
|
|
|
+ $data['工单编号'] = empty($params['order']) ? '':$params['order'];
|
|
|
|
|
+ $data['印件号'] = empty($params['yjno']) ? '':$params['yjno'];
|
|
|
|
|
+ $data['工序号'] = empty($params['gy_name']) ? '' : (int)substr($params['gy_name'], 0, 2);
|
|
|
|
|
+ $data['工序名称'] = empty($params['gy_name']) ? '' : $params['gy_name'];
|
|
|
$data['当班产量'] = $params['production_now'];
|
|
$data['当班产量'] = $params['production_now'];
|
|
|
$data['累计产量'] = $params['production_all'];
|
|
$data['累计产量'] = $params['production_all'];
|
|
|
$data['班组编号'] = $params['sczl_bzdh'];
|
|
$data['班组编号'] = $params['sczl_bzdh'];
|
|
@@ -1645,10 +1659,14 @@ class Facility extends Api
|
|
|
} elseif ($current_time > $end_time1 && $current_time <= $start_time3) {
|
|
} elseif ($current_time > $end_time1 && $current_time <= $start_time3) {
|
|
|
$data['开工时间'] = date('Y-m-d', strtotime('+1 day')) . ' 08:30:00';
|
|
$data['开工时间'] = date('Y-m-d', strtotime('+1 day')) . ' 08:30:00';
|
|
|
}
|
|
}
|
|
|
- $option['Gy0_gdbh'] = $params['order'];
|
|
|
|
|
- $option['Gy0_yjno'] = $params['yjno'];
|
|
|
|
|
- $option['Gy0_gxh'] = $data['工序号'];
|
|
|
|
|
- $data['任务ID'] = \db('工单_工艺资料')->where($option)->value('UniqId');
|
|
|
|
|
|
|
+ if (!empty($params['order']) && !empty($params['yjno'])){
|
|
|
|
|
+ $option['Gy0_gdbh'] = $params['order'];
|
|
|
|
|
+ $option['Gy0_yjno'] = $params['yjno'];
|
|
|
|
|
+ $option['Gy0_gxh'] = $data['工序号'];
|
|
|
|
|
+ $data['任务ID'] = \db('工单_工艺资料')->where($option)->value('UniqId');
|
|
|
|
|
+ }else{
|
|
|
|
|
+ $data['任务ID'] = '';
|
|
|
|
|
+ }
|
|
|
$data['UniqId'] = $id;
|
|
$data['UniqId'] = $id;
|
|
|
$sql = \db('设备_产量采集')->fetchSql(true)->insert($data);
|
|
$sql = \db('设备_产量采集')->fetchSql(true)->insert($data);
|
|
|
$res = Db::query($sql);
|
|
$res = Db::query($sql);
|
|
@@ -1922,6 +1940,7 @@ class Facility extends Api
|
|
|
}
|
|
}
|
|
|
$param['sczl_打样工时'] = $param['sczl_打样总工时'];
|
|
$param['sczl_打样工时'] = $param['sczl_打样总工时'];
|
|
|
$param['sczl_装版工时'] = $param['sczl_装版总工时'];
|
|
$param['sczl_装版工时'] = $param['sczl_装版总工时'];
|
|
|
|
|
+ $param['mod_rq'] = date('Y-m-d H:i:s',time());
|
|
|
$data = $param;
|
|
$data = $param;
|
|
|
unset($data['UniqId']);
|
|
unset($data['UniqId']);
|
|
|
$sql = \db('设备_产量计酬')
|
|
$sql = \db('设备_产量计酬')
|
|
@@ -2103,12 +2122,17 @@ class Facility extends Api
|
|
|
$this->error('请求错误');
|
|
$this->error('请求错误');
|
|
|
}
|
|
}
|
|
|
$param = $this->request->param();
|
|
$param = $this->request->param();
|
|
|
- if (empty($param['machine'])){
|
|
|
|
|
|
|
+ if (empty($param)){
|
|
|
$this->error('参数错误');
|
|
$this->error('参数错误');
|
|
|
}
|
|
}
|
|
|
- $where = [
|
|
|
|
|
- 'b.Gy0_sbbh' => ['like','%'.$param['machine'].'%'],
|
|
|
|
|
- ];
|
|
|
|
|
|
|
+// $where = [
|
|
|
|
|
+// 'b.Gy0_sbbh' => ['like','%'.$param['machine'].'%'],
|
|
|
|
|
+// ];
|
|
|
|
|
+// if (!empty($param['machine'])){
|
|
|
|
|
+// $where = [
|
|
|
|
|
+// 'b.Gy0_sbbh' => ['like','%'.$param['machine'].'%'],
|
|
|
|
|
+// ];
|
|
|
|
|
+// }
|
|
|
if (!empty($param['search'])){
|
|
if (!empty($param['search'])){
|
|
|
$where['b.Gy0_gdbh'] = ['like','%'.$param['search'].'%'];
|
|
$where['b.Gy0_gdbh'] = ['like','%'.$param['search'].'%'];
|
|
|
}
|
|
}
|
|
@@ -2363,4 +2387,117 @@ class Facility extends Api
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 检品机日产量上报数据修改
|
|
|
|
|
+ * @return void
|
|
|
|
|
+ * @throws \think\Exception
|
|
|
|
|
+ * @throws \think\db\exception\BindParamException
|
|
|
|
|
+ * @throws \think\exception\PDOException
|
|
|
|
|
+ */
|
|
|
|
|
+ public function JpChanliangEdit()
|
|
|
|
|
+ {
|
|
|
|
|
+ if (Request::instance()->isPost() == false){
|
|
|
|
|
+ $this->error('非法请求');
|
|
|
|
|
+ }
|
|
|
|
|
+ $params = Request::instance()->post();
|
|
|
|
|
+ if (empty($params['UniqId'])){
|
|
|
|
|
+ $this->error('参数错误');
|
|
|
|
|
+ }
|
|
|
|
|
+ $params['mod_rq'] = date('Y-m-d H:i:s');
|
|
|
|
|
+ $data = $params;
|
|
|
|
|
+ $data['sczl_装版总工时'] = $params['sczl_装版工时'];
|
|
|
|
|
+ unset($data['UniqId']);
|
|
|
|
|
+ $sql = \db('设备_产量计酬')->where('UniqId',$params['UniqId'])->fetchSql(true)->update($data);
|
|
|
|
|
+ $res = \db()->query($sql);
|
|
|
|
|
+ if ($res === false){
|
|
|
|
|
+ $this->error('修改失败');
|
|
|
|
|
+ }else{
|
|
|
|
|
+ $this->success('成功');
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 检品机日产量上报数据列表
|
|
|
|
|
+ * @return void
|
|
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
|
|
+ * @throws \think\exception\DbException
|
|
|
|
|
+ */
|
|
|
|
|
+ public function JPmachineDetail()
|
|
|
|
|
+ {
|
|
|
|
|
+ if ($this->request->isGet() === false){
|
|
|
|
|
+ $this->error('请求错误');
|
|
|
|
|
+ }
|
|
|
|
|
+ $machine = input('machine');
|
|
|
|
|
+ $date = input('date');
|
|
|
|
|
+ $where = [
|
|
|
|
|
+ 'sczl_jtbh' => $machine,
|
|
|
|
|
+ 'sczl_rq' => date('Y-m-d H:i:s',strtotime($date.' 00:00:00')),
|
|
|
|
|
+ ];
|
|
|
|
|
+ $field = 'rtrim(sczl_gdbh) as 工单编号,rtrim(sczl_dedh) as dedh,rtrim(sczl_yjno) as yjno,rtrim(sczl_gxh) as gxh,rtrim(sczl_gxmc) as gxmc,rtrim(sczl_type) as 检验类型,rtrim(sczl_num) as num,rtrim(sczl_cl) as 计件箱数,
|
|
|
|
|
+ rtrim(sczl_Pgcl) as 每箱数量,rtrim(sczl_bzdh) as bzdh,IF(sczl_废品率系数 = 0, "",sczl_废品率系数) as 废品率系数,IF(sczl_装版工时 = 0, "",sczl_装版工时) as 换膜补时, IF(sczl_保养工时 = 0, "",sczl_保养工时) as 保养工时,IF(sczl_异常停机工时 = 0, "",sczl_异常停机工时) as 异常总工时,IF(sczl_设备运行工时 = 0, "",sczl_设备运行工时) as 通电工时,
|
|
|
|
|
+ rtrim(sys_id) as 用户,rtrim(mod_rq) as 更新时间,IF(sczl_异常工时1 = 0, "",sczl_异常工时1) as 异常补时,IF(sczl_异常类型1 = 0, "",sczl_异常类型1) as 异常类型,sczl_bh1,sczl_bh2,
|
|
|
|
|
+ sczl_bh3,sczl_bh4,sczl_bh5,sczl_bh6,sczl_bh7,sczl_bh8,sczl_bh9,sczl_bh10,sczl_rate1,sczl_rate2,sczl_rate3,sczl_rate4,sczl_rate5,sczl_rate6,sczl_rate7,
|
|
|
|
|
+ sczl_rate8,sczl_rate9,sczl_rate10,sczl_bh98,rtrim(UniqId) as UniqId,rtrim(sczl_工价系数) as 难度系数,rtrim(sczl_dedh) as 定额代号,sczl_rq,sczl_装版总工时 as 换膜总工时';
|
|
|
|
|
+ //机台信息
|
|
|
|
|
+ $machineDetail = \db('设备_基本资料')->where('设备编号',$machine)->field('rtrim(千件工价) as 千件工价,rtrim(日定额) as 日定额')->find();
|
|
|
|
|
+ //组员信息
|
|
|
|
|
+ $list = \db('设备_产量计酬')->where($where)->field($field)->select();
|
|
|
|
|
+ $totalA = \db('设备_产量计酬')
|
|
|
|
|
+ ->where($where)
|
|
|
|
|
+ ->where('sczl_bzdh','like','A%')
|
|
|
|
|
+ ->field('sczl_type as 检验类型,SUM(sczl_cl) as 箱数')
|
|
|
|
|
+ ->group('检验类型')
|
|
|
|
|
+ ->select();
|
|
|
|
|
+ $totalB = \db('设备_产量计酬')
|
|
|
|
|
+ ->where($where)
|
|
|
|
|
+ ->where('sczl_bzdh','like','B%')
|
|
|
|
|
+ ->field('sczl_type as 检验类型,SUM(sczl_cl) as 箱数')
|
|
|
|
|
+ ->group('检验类型')
|
|
|
|
|
+ ->select();
|
|
|
|
|
+ if (empty($list)){
|
|
|
|
|
+ $this->success('',[]);
|
|
|
|
|
+ }
|
|
|
|
|
+ foreach ($list as $key=>$value){
|
|
|
|
|
+ //产品名称
|
|
|
|
|
+ $productName = \db('工单_基本资料')->whereIn('Gd_gdbh',$value['工单编号'])->field('rtrim(成品名称) as 成品名称,rtrim(Gd_cpmc) as cpmc')->find();
|
|
|
|
|
+ if (!empty($productName)){
|
|
|
|
|
+ if (!empty($productName['成品名称'])){
|
|
|
|
|
+ $list[$key]['产品名称'] = $value['工单编号'].'---'.$productName['成品名称'];
|
|
|
|
|
+ $list[$key]['cpmc'] = $productName['成品名称'];
|
|
|
|
|
+ }else{
|
|
|
|
|
+ $list[$key]['产品名称'] = $value['工单编号'];
|
|
|
|
|
+ $list[$key]['cpmc'] = '';
|
|
|
|
|
+ }
|
|
|
|
|
+ }else{
|
|
|
|
|
+ $list[$key]['产品名称'] = $value['工单编号'];
|
|
|
|
|
+ $list[$key]['cpmc'] = '';
|
|
|
|
|
+ }
|
|
|
|
|
+ if (empty($value['定额代号'])){
|
|
|
|
|
+ $list[$key]['千件工价'] = '';
|
|
|
|
|
+ $list[$key]['日定额'] = '';
|
|
|
|
|
+ $list[$key]['补产标准'] = '';
|
|
|
|
|
+ }else{
|
|
|
|
|
+ $row = \db('dic_lzde')->where('sys_bh',$value['定额代号'])->field('rtrim(千件工价) as 千件工价,rtrim(日定额) as 日定额,rtrim(补产标准) as 补产标准')->find();
|
|
|
|
|
+ $list[$key]['千件工价'] = $row['千件工价'];
|
|
|
|
|
+ $list[$key]['日定额'] = $row['日定额'];
|
|
|
|
|
+ $list[$key]['补产标准'] = $row['补产标准'];
|
|
|
|
|
+ }
|
|
|
|
|
+ $list[$key]['工序'] = $list[$key]['yjno'].'-'.$list[$key]['gxmc'];
|
|
|
|
|
+ for ($i=1;$i<11;$i++){
|
|
|
|
|
+ if (isset($value['sczl_bh'.$i])){
|
|
|
|
|
+ $name = \db('人事_基本资料')->where('员工编号',$value['sczl_bh'.$i])->field('员工姓名 as name')->find();
|
|
|
|
|
+ if (isset($name['name'])){
|
|
|
|
|
+ $list[$key]['组员'.$i] = $value['sczl_bh'.$i].$name['name'].'('.((float)$value['sczl_rate'.$i]*100).'%'.')';
|
|
|
|
|
+ $list[$key]['sczl_name'.$i] = $name['name'];
|
|
|
|
|
+ }else{
|
|
|
|
|
+ $list[$key]['sczl_name'.$i] = '';
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ $list['totalA'] = $totalA;
|
|
|
|
|
+ $list['totalB'] = $totalB;
|
|
|
|
|
+ $this->success('成功',$list);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|