|
|
@@ -166,60 +166,60 @@ class WorkOrderVerification extends Api
|
|
|
fp_bz1,fp_bz2,fp_bz3,fp_bz4,fp_bz5,fp_bz6,fp_bz7,fp_bz8,fp_bz9,fp_bz10,fp_bz11,fp_bz12,fp_bz13,
|
|
|
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,
|
|
|
sys_id,rtrim(sys_rq) as sys_rq,UniqId';
|
|
|
- $list = Db::name('db_qczl')->where('UniqId',$params['UniqId'])->field($field)->find();
|
|
|
+ $list = db('db_qczl')->where('UniqId',$params['UniqId'])->field($field)->find();
|
|
|
$list['fp_name1'] = '';
|
|
|
if (!empty($list['fp_bh1'])){
|
|
|
- $list['fp_name1'] = Db::name('人事_基本资料')->where('员工编号',$list['fp_bh1'])->value('rtrim(员工姓名)');
|
|
|
+ $list['fp_name1'] = db('人事_基本资料')->where('员工编号',$list['fp_bh1'])->value('rtrim(员工姓名)');
|
|
|
}
|
|
|
$list['fp_name2'] = '';
|
|
|
if (!empty($list['fp_bh2'])){
|
|
|
- $list['fp_name2'] = Db::name('人事_基本资料')->where('员工编号',$list['fp_bh2'])->value('rtrim(员工姓名)');
|
|
|
+ $list['fp_name2'] = db('人事_基本资料')->where('员工编号',$list['fp_bh2'])->value('rtrim(员工姓名)');
|
|
|
}
|
|
|
$list['fp_name3'] = '';
|
|
|
if (!empty($list['fp_bh3'])){
|
|
|
- $list['fp_name3'] = Db::name('人事_基本资料')->where('员工编号',$list['fp_bh3'])->value('rtrim(员工姓名)');
|
|
|
+ $list['fp_name3'] = db('人事_基本资料')->where('员工编号',$list['fp_bh3'])->value('rtrim(员工姓名)');
|
|
|
}
|
|
|
$list['fp_name4'] = '';
|
|
|
if (!empty($list['fp_bh4'])){
|
|
|
- $list['fp_name4'] = Db::name('人事_基本资料')->where('员工编号',$list['fp_bh4'])->value('rtrim(员工姓名)');
|
|
|
+ $list['fp_name4'] = db('人事_基本资料')->where('员工编号',$list['fp_bh4'])->value('rtrim(员工姓名)');
|
|
|
}
|
|
|
$list['fp_name5'] = '';
|
|
|
if (!empty($list['fp_bh5'])){
|
|
|
- $list['fp_name5'] = Db::name('人事_基本资料')->where('员工编号',$list['fp_bh5'])->value('rtrim(员工姓名)');
|
|
|
+ $list['fp_name5'] = db('人事_基本资料')->where('员工编号',$list['fp_bh5'])->value('rtrim(员工姓名)');
|
|
|
}
|
|
|
$list['fp_name6'] = '';
|
|
|
if (!empty($list['fp_bh6'])){
|
|
|
- $list['fp_name6'] = Db::name('人事_基本资料')->where('员工编号',$list['fp_bh6'])->value('rtrim(员工姓名)');
|
|
|
+ $list['fp_name6'] = db('人事_基本资料')->where('员工编号',$list['fp_bh6'])->value('rtrim(员工姓名)');
|
|
|
}
|
|
|
$list['fp_name7'] = '';
|
|
|
if (!empty($list['fp_bh7'])){
|
|
|
- $list['fp_name7'] = Db::name('人事_基本资料')->where('员工编号',$list['fp_bh7'])->value('rtrim(员工姓名)');
|
|
|
+ $list['fp_name7'] = db('人事_基本资料')->where('员工编号',$list['fp_bh7'])->value('rtrim(员工姓名)');
|
|
|
}
|
|
|
$list['fp_name8'] = '';
|
|
|
if (!empty($list['fp_bh8'])){
|
|
|
- $list['fp_name8'] = Db::name('人事_基本资料')->where('员工编号',$list['fp_bh8'])->value('rtrim(员工姓名)');
|
|
|
+ $list['fp_name8'] = db('人事_基本资料')->where('员工编号',$list['fp_bh8'])->value('rtrim(员工姓名)');
|
|
|
}
|
|
|
$list['fp_name9'] = '';
|
|
|
if (!empty($list['fp_bh9'])){
|
|
|
- $list['fp_name9'] = Db::name('人事_基本资料')->where('员工编号',$list['fp_bh9'])->value('rtrim(员工姓名)');
|
|
|
+ $list['fp_name9'] = db('人事_基本资料')->where('员工编号',$list['fp_bh9'])->value('rtrim(员工姓名)');
|
|
|
}
|
|
|
$list['fp_name10'] = '';
|
|
|
if (!empty($list['fp_bh10'])){
|
|
|
- $list['fp_name10'] = Db::name('人事_基本资料')->where('员工编号',$list['fp_bh10'])->value('rtrim(员工姓名)');
|
|
|
+ $list['fp_name10'] = db('人事_基本资料')->where('员工编号',$list['fp_bh10'])->value('rtrim(员工姓名)');
|
|
|
}
|
|
|
$list['fp_name11'] = '';
|
|
|
if (!empty($list['fp_bh11'])){
|
|
|
- $list['fp_name11'] = Db::name('人事_基本资料')->where('员工编号',$list['fp_bh11'])->value('rtrim(员工姓名)');
|
|
|
+ $list['fp_name11'] = db('人事_基本资料')->where('员工编号',$list['fp_bh11'])->value('rtrim(员工姓名)');
|
|
|
}
|
|
|
$list['fp_name12'] = '';
|
|
|
if (!empty($list['fp_bh12'])){
|
|
|
- $list['fp_name12'] = Db::name('人事_基本资料')->where('员工编号',$list['fp_bh12'])->value('rtrim(员工姓名)');
|
|
|
+ $list['fp_name12'] = db('人事_基本资料')->where('员工编号',$list['fp_bh12'])->value('rtrim(员工姓名)');
|
|
|
}
|
|
|
$list['fp_name13'] = '';
|
|
|
if (!empty($list['fp_bh13'])){
|
|
|
- $list['fp_name13'] = Db::name('人事_基本资料')->where('员工编号',$list['fp_bh13'])->value('rtrim(员工姓名)');
|
|
|
+ $list['fp_name13'] = db('人事_基本资料')->where('员工编号',$list['fp_bh13'])->value('rtrim(员工姓名)');
|
|
|
}
|
|
|
- $max = Db::name('设备_产量计酬')->where('sczl_gdbh',$list['qczl_gdbh'])->field('MAX(sczl_num) as sczl_num')->find();
|
|
|
+ $max = db('设备_产量计酬')->where('sczl_gdbh',$list['qczl_gdbh'])->field('MAX(sczl_num) as sczl_num')->find();
|
|
|
$list['total_liucheng'] = $max['sczl_num'];
|
|
|
$this->success('请求成功',$list);
|
|
|
}
|
|
|
@@ -236,7 +236,7 @@ class WorkOrderVerification extends Api
|
|
|
if (!isset($params['order']) || empty($params['order'])){
|
|
|
$this->error('参数错误');
|
|
|
}
|
|
|
- $list = Db::name('工单_基本资料')->alias('a')
|
|
|
+ $list = db('工单_基本资料')->alias('a')
|
|
|
->join('工单_印件资料 b','a.Gd_gdbh = b.Yj_Gdbh','left')
|
|
|
->where('a.Gd_gdbh',$params['order'])
|
|
|
->where('a.行号',1)
|
|
|
@@ -263,13 +263,13 @@ class WorkOrderVerification extends Api
|
|
|
}
|
|
|
$where['Yj_Gdbh'] = $params['order'];
|
|
|
$where['yj_Yjno'] = $params['yj_no'];
|
|
|
- $list = Db::name('工单_印件资料')->where($where)->field('yj_yjmc')->find();
|
|
|
+ $list = db('工单_印件资料')->where($where)->field('yj_yjmc')->find();
|
|
|
$option['Gy0_gdbh'] = $params['order'];
|
|
|
$option['Gy0_yjno'] = $params['yj_no'];
|
|
|
$option['Gy0_site'] = '检验车间';
|
|
|
$option['Gy0_gxmc'] = array('not in',['包装','外发加工','废挑正','成品防护']);
|
|
|
- $gxList = Db::name('工单_工艺资料')->where($option)->field('Gy0_gxh,rtrim(Gy0_gxmc) as Gy0_gxmc,rtrim(Add_gxmc) as Add_gxmc')->select();
|
|
|
- $max = Db::name('设备_产量计酬')->where('sczl_gdbh',$params['order'])->where('sczl_yjno',$params['yj_no'])->field('MAX(sczl_num) as sczl_num')->value('sczl_num');
|
|
|
+ $gxList = db('工单_工艺资料')->where($option)->field('Gy0_gxh,rtrim(Gy0_gxmc) as Gy0_gxmc,rtrim(Add_gxmc) as Add_gxmc')->select();
|
|
|
+ $max = db('设备_产量计酬')->where('sczl_gdbh',$params['order'])->where('sczl_yjno',$params['yj_no'])->field('MAX(sczl_num) as sczl_num')->value('sczl_num');
|
|
|
$list['gx_data'] = $gxList;
|
|
|
$list['max_num'] = $max;
|
|
|
$this->success('请求成功',$list);
|
|
|
@@ -290,7 +290,7 @@ class WorkOrderVerification extends Api
|
|
|
}
|
|
|
$where['分类'] = '废品分类';
|
|
|
$where['名称'] = array('like','%'.$params['search'].'%');
|
|
|
- $data = Db::name('erp_常用字典')->where($where)->column('名称');
|
|
|
+ $data = db('erp_常用字典')->where($where)->column('名称');
|
|
|
// 分割字符串并合并相同项
|
|
|
$resultArray = [];
|
|
|
foreach ($data as $item) {
|
|
|
@@ -335,7 +335,7 @@ class WorkOrderVerification extends Api
|
|
|
$this->error('参数错误');
|
|
|
}
|
|
|
$type = trim($params['type']);
|
|
|
- $waste = Db::name('erp_常用字典')->where('名称','like','%'.$type.'%')->find();
|
|
|
+ $waste = db('erp_常用字典')->where('名称','like','%'.$type.'%')->find();
|
|
|
if (empty($waste)){
|
|
|
$this->error('未查询到废品分类');
|
|
|
}
|
|
|
@@ -344,7 +344,7 @@ class WorkOrderVerification extends Api
|
|
|
$search = substr($searchArr[1],0,6);
|
|
|
$where['a.sczl_gdbh'] = $params['order'];
|
|
|
$where['a.sczl_type'] = array('like','%'.$search.'%');
|
|
|
- $list = Db::name('设备_产量计酬')->alias('a')
|
|
|
+ $list = db('设备_产量计酬')->alias('a')
|
|
|
->join('人事_基本资料 b','a.sczl_bh1 = b.员工编号','left')
|
|
|
->where($where)->field('distinct(a.sczl_gxmc),a.sczl_bzdh,a.sczl_jtbh,a.sczl_bh1,b.员工姓名 as name')
|
|
|
->select();
|
|
|
@@ -371,7 +371,7 @@ class WorkOrderVerification extends Api
|
|
|
}
|
|
|
$id = $params['UniqId'];
|
|
|
unset($params['UniqId']);
|
|
|
- $sql = Db::name('db_qczl')->where('UniqId',$id)->fetchSql(true)->update($params);
|
|
|
+ $sql = db('db_qczl')->where('UniqId',$id)->fetchSql(true)->update($params);
|
|
|
$res = Db::query($sql);
|
|
|
if ($res !== 0){
|
|
|
$this->success('更新成功');
|
|
|
@@ -397,7 +397,7 @@ class WorkOrderVerification extends Api
|
|
|
rtrim(fp_lb8) as fp_lb8,rtrim(fp_lb9) as fp_lb9,rtrim(fp_lb10) as fp_lb10,rtrim(fp_lb11) as fp_lb11,rtrim(fp_lb12) as fp_lb12,rtrim(fp_lb13) as fp_lb13,
|
|
|
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
|
|
|
';
|
|
|
- $data = Db::name('db_qczl')->name('db_qczl')->where('qczl_gdbh',$params['order'])->field($field)->select();
|
|
|
+ $data = db('db_qczl')->name('db_qczl')->where('qczl_gdbh',$params['order'])->field($field)->select();
|
|
|
if (empty($data)){
|
|
|
$this->error('暂无废品数据');
|
|
|
}
|
|
|
@@ -421,19 +421,19 @@ class WorkOrderVerification extends Api
|
|
|
}
|
|
|
}
|
|
|
ksort($categories);
|
|
|
- $wasteTotal = Db::name('db_qczl')->where('qczl_gdbh',$params['order'])->sum('qczl_fp');
|
|
|
+ $wasteTotal = db('db_qczl')->where('qczl_gdbh',$params['order'])->sum('qczl_fp');
|
|
|
if (empty($wasteTotal)){
|
|
|
$wasteTotal = 0;
|
|
|
}
|
|
|
$where['a.Gd_gdbh'] = $params['order'];
|
|
|
$where['a.行号'] = 1;
|
|
|
- $gdInfo = Db::name('工单_基本资料')->alias('a')
|
|
|
+ $gdInfo = db('工单_基本资料')->alias('a')
|
|
|
->join('工单_印件资料 b','a.Gd_gdbh = b.Yj_Gdbh','left')
|
|
|
->where($where)->field('a.Gd_gdbh,a.实际投料,b.yj_Yjno,b.yj_yjmc')->find();
|
|
|
$gdInfo['yj_Yjno'] = $gdInfo['yj_Yjno'] > 10 ? $gdInfo['yj_Yjno']:'0'.$gdInfo['yj_Yjno'];
|
|
|
$gdInfo['实际投料'] = (int)($gdInfo['实际投料'] * 10000);
|
|
|
$gdInfo['wasteTotal'] = $wasteTotal;
|
|
|
- $finishNum = Db::name('成品入仓')->where('jjcp_gdbh',$params['order'])->sum('jjcp_sl');
|
|
|
+ $finishNum = db('成品入仓')->where('jjcp_gdbh',$params['order'])->sum('jjcp_sl');
|
|
|
$gdInfo['passRate'] = '';
|
|
|
if (!empty($finishNum)){
|
|
|
$gdInfo['passRate'] = number_format((int)$finishNum/$gdInfo['实际投料']*100,2).'%';
|
|
|
@@ -470,7 +470,7 @@ class WorkOrderVerification extends Api
|
|
|
$i = 0;
|
|
|
$name = array();
|
|
|
foreach ($newArray as $key=>$value){
|
|
|
- $item = Db::name('erp_常用字典')->where('名称','like','%'.$key.'%')->value('名称');
|
|
|
+ $item = db('erp_常用字典')->where('名称','like','%'.$key.'%')->value('名称');
|
|
|
$item = explode('_',substr($item,0,-1));
|
|
|
$rightData[$i]['type'] = $item[1];
|
|
|
$rightData[$i]['rate'] = number_format($value/$wasteTotal*100,0).'%';
|
|
|
@@ -499,8 +499,8 @@ class WorkOrderVerification extends Api
|
|
|
}
|
|
|
$where['a.Gy0_gdbh'] = $params['order'];
|
|
|
$where['a.Gy0_sbbh'] = array('neq',' ');
|
|
|
- $productNum = Db::name('工单_基本资料')->where('Gd_gdbh',$params['order'])->value('计划投料');
|
|
|
- $gyData = Db::name('工单_工艺资料')->alias('a')
|
|
|
+ $productNum = db('工单_基本资料')->where('Gd_gdbh',$params['order'])->value('计划投料');
|
|
|
+ $gyData = db('工单_工艺资料')->alias('a')
|
|
|
->join('设备_产量计酬 b','a.Gy0_gdbh = b.sczl_gdbh and a.Gy0_gxh = b.sczl_gxh','left')
|
|
|
->where($where)
|
|
|
->field('a.Gy0_yjno,a.Gy0_gxh,rtrim(a.Gy0_gxmc) as Gy0_gxmc,a.Gy0_sbbh,a.Gy0_Rate0,a.Gy0_Rate1,a.损耗系数 as Gy0_Rate3,a.Gy0_Ms,a.Gy0_SITE,a.Gy0_计划接货数,a.PD_WG,
|
|
|
@@ -570,7 +570,7 @@ class WorkOrderVerification extends Api
|
|
|
if (empty($params['date'])){
|
|
|
$params['date'] = '1900-01-01 00:00:00';
|
|
|
}
|
|
|
- $res = Db::name('工单_工艺资料')->where('UniqId',$params['UniqId'])->setField('PD_WG',$params['date']);
|
|
|
+ $res = db('工单_工艺资料')->where('UniqId',$params['UniqId'])->setField('PD_WG',$params['date']);
|
|
|
if ($res != false){
|
|
|
$this->success('更新成功');
|
|
|
}else{
|
|
|
@@ -593,10 +593,10 @@ class WorkOrderVerification extends Api
|
|
|
$where['Gd_gdbh'] = $params['order'];
|
|
|
$where['行号'] = 1;
|
|
|
//工单基本资料
|
|
|
- $info = Db::name('工单_基本资料')->where($where)->field('rtrim(成品代号) as code,rtrim(成品名称) as name')->find();
|
|
|
+ $info = db('工单_基本资料')->where($where)->field('rtrim(成品代号) as code,rtrim(成品名称) as name')->find();
|
|
|
//工艺资料
|
|
|
$option['Gy0_gdbh'] = $params['order'];
|
|
|
- $gyInfo = Db::name('工单_工艺资料')
|
|
|
+ $gyInfo = db('工单_工艺资料')
|
|
|
->where($option)
|
|
|
->where(function ($query) {
|
|
|
$query->where('Gy0_sbbh', '<>', '')
|
|
|
@@ -630,10 +630,10 @@ class WorkOrderVerification extends Api
|
|
|
if (!isset($params['gxNo']) || empty($params['gxNo'])){
|
|
|
$this->error('参数错误');
|
|
|
}
|
|
|
- $total = Db::name('设备_产量计酬')->where('sczl_gdbh',$params['order'])->order('sczl_num')->column('distinct(sczl_num)');
|
|
|
+ $total = db('设备_产量计酬')->where('sczl_gdbh',$params['order'])->order('sczl_num')->column('distinct(sczl_num)');
|
|
|
$where['sczl_gxh'] = (int)$params['gxNo'];
|
|
|
$where['sczl_gdbh'] = $params['order'];
|
|
|
- $process = Db::name('设备_产量计酬')->where($where)->order('sczl_num')->column('distinct(sczl_num)');
|
|
|
+ $process = db('设备_产量计酬')->where($where)->order('sczl_num')->column('distinct(sczl_num)');
|
|
|
$res['total_process'] = $total;
|
|
|
$res['process'] = $process;
|
|
|
$this->success('请求成功',$res);
|
|
|
@@ -667,7 +667,7 @@ class WorkOrderVerification extends Api
|
|
|
qczl_rq
|
|
|
';
|
|
|
|
|
|
- $data = Db::name('db_qczl')
|
|
|
+ $data = db('db_qczl')
|
|
|
->where($where)
|
|
|
->where(function ($query) {
|
|
|
for ($i = 1; $i <= 13; $i++) {
|
|
|
@@ -688,7 +688,7 @@ class WorkOrderVerification extends Api
|
|
|
$list[$j]['fp_lb'] = $entry[$labelKey];
|
|
|
$list[$j]['fp_sl'] = $entry[$slKey];
|
|
|
$list[$j]['fp_bh'] = $entry[$bhKey];
|
|
|
- $name = Db::name('人事_基本资料')->where('员工编号',$entry[$bhKey])->value('rtrim(员工姓名)');
|
|
|
+ $name = db('人事_基本资料')->where('员工编号',$entry[$bhKey])->value('rtrim(员工姓名)');
|
|
|
$list[$j]['fp_name'] = empty($name) ? '计时工' : $name;
|
|
|
$list[$j]['fp_bz'] = $entry[$bzKey];
|
|
|
$list[$j]['qczl_rq'] = $entry['qczl_rq'];
|
|
|
@@ -771,7 +771,7 @@ class WorkOrderVerification extends Api
|
|
|
';
|
|
|
$where['a.qczl_gdbh'] = $params['order'];
|
|
|
$where['b.行号'] = 1;
|
|
|
- $data = Db::name('db_qczl')->alias('a')
|
|
|
+ $data = db('db_qczl')->alias('a')
|
|
|
->join('工单_基本资料 b','a.qczl_gdbh = b.Gd_gdbh','left')
|
|
|
->join('工单_印件资料 c','a.qczl_gdbh = c.Yj_Gdbh','left')
|
|
|
->join('成品入仓 d','a.qczl_gdbh = d.jjcp_gdbh','left')
|
|
|
@@ -789,7 +789,7 @@ class WorkOrderVerification extends Api
|
|
|
$list[$j]['fp_lb'] = $entry[$labelKey];
|
|
|
$list[$j]['fp_sl'] = $entry[$slKey];
|
|
|
$list[$j]['fp_bh'] = $entry[$bhKey];
|
|
|
- $name = Db::name('人事_基本资料')->where('员工编号',$entry[$bhKey])->value('rtrim(员工姓名)');
|
|
|
+ $name = db('人事_基本资料')->where('员工编号',$entry[$bhKey])->value('rtrim(员工姓名)');
|
|
|
$list[$j]['fp_name'] = $name;
|
|
|
$list[$j]['fp_gxh'] = empty(substr($entry[$gxhKey],0,2)) ? "0" : substr($entry[$gxhKey],0,2);
|
|
|
$list[$j]['qczl_num'] = $entry['qczl_num'];
|