|
@@ -89,28 +89,37 @@ class Facility extends Api
|
|
|
'sczl_jtbh' => $machine,
|
|
'sczl_jtbh' => $machine,
|
|
|
'sczl_rq' => date('Y-m-d H:i:s',strtotime($date.' 00:00:00')),
|
|
'sczl_rq' => date('Y-m-d H:i:s',strtotime($date.' 00:00:00')),
|
|
|
];
|
|
];
|
|
|
- $field = 'rtrim(sczl_gdbh) as 工单编号,rtrim(sczl_yjno) as yjno,rtrim(sczl_gxmc) as gxmc,rtrim(sczl_num) as num,rtrim(sczl_sj1) as sj1,
|
|
|
|
|
|
|
+ $field = 'rtrim(sczl_gdbh) as 工单编号,rtrim(sczl_dedh) as dedh,rtrim(sczl_yjno) as yjno,rtrim(sczl_gxmc) as gxmc,rtrim(sczl_num) as num,rtrim(sczl_sj1) as sj1,
|
|
|
rtrim(sczl_sj2) as sj2,rtrim(sczl_cl) as 产量,rtrim(sczl_bzdh) as bzdh,rtrim(sczl_zcfp) as 制程废品,rtrim(sczl_zccp) as 制程次品,rtrim(sczl_前工序废) as 前工序废,rtrim(sczl_来料少数) as 来料异常,
|
|
rtrim(sczl_sj2) as sj2,rtrim(sczl_cl) as 产量,rtrim(sczl_bzdh) as bzdh,rtrim(sczl_zcfp) as 制程废品,rtrim(sczl_zccp) as 制程次品,rtrim(sczl_前工序废) as 前工序废,rtrim(sczl_来料少数) as 来料异常,
|
|
|
rtrim(sczl_装版工时) as 装版工时,rtrim(sczl_保养工时) as 保养工时,rtrim(sczl_打样工时) as 打样工时,rtrim(sczl_异常停机工时) as 异常总工时,rtrim(sczl_设备运行工时) as 通电工时,
|
|
rtrim(sczl_装版工时) as 装版工时,rtrim(sczl_保养工时) as 保养工时,rtrim(sczl_打样工时) as 打样工时,rtrim(sczl_异常停机工时) as 异常总工时,rtrim(sczl_设备运行工时) as 通电工时,
|
|
|
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(sys_id) as 用户,rtrim(mod_rq) as 更新时间,rtrim(sczl_异常工时1) as 异常补时,rtrim(sczl_异常类型1) as 异常类型,sczl_bh1,sczl_bh2,
|
|
rtrim(sys_id) as 用户,rtrim(mod_rq) as 更新时间,rtrim(sczl_异常工时1) as 异常补时,rtrim(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_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_rate8,sczl_rate9,sczl_rate10,sczl_bh98,rtrim(UniqId) as UniqId';
|
|
|
//机台信息
|
|
//机台信息
|
|
|
$machineDetail = \db('设备_基本资料')->where('设备编号',$machine)->field('rtrim(千件工价) as 千件工价,rtrim(日定额) as 日定额')->find();
|
|
$machineDetail = \db('设备_基本资料')->where('设备编号',$machine)->field('rtrim(千件工价) as 千件工价,rtrim(日定额) as 日定额')->find();
|
|
|
//工单编号
|
|
//工单编号
|
|
|
$Gd_gdbh = \db('设备_产量计酬')->where($where)->distinct(true)->column('sczl_gdbh');
|
|
$Gd_gdbh = \db('设备_产量计酬')->where($where)->distinct(true)->column('sczl_gdbh');
|
|
|
//产品名称
|
|
//产品名称
|
|
|
- $productName = \db('工单_基本资料')->whereIn('Gd_gdbh',$Gd_gdbh)->field('rtrim(Gd_gdbh) as gdbh')->find();
|
|
|
|
|
|
|
+ $productName = \db('工单_基本资料')->whereIn('Gd_gdbh',$Gd_gdbh)->field('rtrim(成品名称) as 成品名称,rtrim(Gd_cpmc) as cpmc')->find();
|
|
|
//组员信息
|
|
//组员信息
|
|
|
- $list = \db('设备_产量计酬')->where($where)->field($field)->cache(true,86400)->select();
|
|
|
|
|
|
|
+ $list = \db('设备_产量计酬')->where($where)->field($field)->select();
|
|
|
$totalA = \db('设备_产量计酬')->where($where)->where('sczl_bzdh','A班')->field('SUM(sczl_cl) as 产量')->select();
|
|
$totalA = \db('设备_产量计酬')->where($where)->where('sczl_bzdh','A班')->field('SUM(sczl_cl) as 产量')->select();
|
|
|
$totalB = \db('设备_产量计酬')->where($where)->where('sczl_bzdh','B班')->field('SUM(sczl_cl) as 产量')->select();
|
|
$totalB = \db('设备_产量计酬')->where($where)->where('sczl_bzdh','B班')->field('SUM(sczl_cl) as 产量')->select();
|
|
|
if (empty($list)){
|
|
if (empty($list)){
|
|
|
$this->success('',[]);
|
|
$this->success('',[]);
|
|
|
}
|
|
}
|
|
|
foreach ($list as $key=>$value){
|
|
foreach ($list as $key=>$value){
|
|
|
- $list[$key]['产品名称'] = $value['工单编号'].'---'.$productName['gdbh'];
|
|
|
|
|
|
|
+ if (!empty($productName['成品名称'])){
|
|
|
|
|
+ $list[$key]['产品名称'] = $value['工单编号'].'---'.$productName['成品名称'];
|
|
|
|
|
+ $list[$key]['cpmc'] = $productName['成品名称'];
|
|
|
|
|
+ }elseif (empty($productName['成品名称']) && !empty($productName['cpmc'])){
|
|
|
|
|
+ $list[$key]['产品名称'] = $value['工单编号'].'---'.$productName['cpmc'];
|
|
|
|
|
+ $list[$key]['cpmc'] = $productName['cpmc'];
|
|
|
|
|
+ }else{
|
|
|
|
|
+ $list[$key]['产品名称'] = $value['工单编号'];
|
|
|
|
|
+ $list[$key]['cpmc'] = '';
|
|
|
|
|
+ }
|
|
|
if ($value['yjno']<10){
|
|
if ($value['yjno']<10){
|
|
|
$list[$key]['yjno'] = '0'.$value['yjno'];
|
|
$list[$key]['yjno'] = '0'.$value['yjno'];
|
|
|
}
|
|
}
|
|
@@ -127,7 +136,6 @@ class Facility extends Api
|
|
|
}
|
|
}
|
|
|
unset($list[$key]['sczl_bh'.$i],$list[$key]['sczl_rate'.$i]);
|
|
unset($list[$key]['sczl_bh'.$i],$list[$key]['sczl_rate'.$i]);
|
|
|
}
|
|
}
|
|
|
- unset($list[$key]['工序编号'],$list[$key]['yjno'],$list[$key]['gxmc'],$list[$key]['num'],$list[$key]['sj1'],$list[$key]['sj2'],$list[$key]['bzdh']);
|
|
|
|
|
}
|
|
}
|
|
|
$list['totalA'] = $totalA[0]['产量'];
|
|
$list['totalA'] = $totalA[0]['产量'];
|
|
|
$list['totalB'] = $totalB[0]['产量'];
|
|
$list['totalB'] = $totalB[0]['产量'];
|
|
@@ -480,11 +488,11 @@ class Facility extends Api
|
|
|
'sczl_jtbh' => $machine,
|
|
'sczl_jtbh' => $machine,
|
|
|
'sczl_bzdh' => $team,
|
|
'sczl_bzdh' => $team,
|
|
|
];
|
|
];
|
|
|
- $field = 'rtrim(sczl_gdbh) as 工单编号,rtrim(sczl_yjno) as yjno,rtrim(sczl_gxmc) as gxmc,rtrim(sczl_num) as 标牌号,rtrim(sczl_cl) as 产量,
|
|
|
|
|
|
|
+ $field = 'rtrim(sczl_gdbh) as 工单编号,rtrim(sczl_yjno) as yjno,rtrim(sczl_num) as 流程单号,rtrim(sczl_dedh) as dedh,rtrim(sczl_gxmc) as gxmc,rtrim(sczl_num) as 标牌号,rtrim(sczl_cl) as 产量,
|
|
|
rtrim(sczl_zcfp) as 制程废品,rtrim(sczl_zccp) as 制程次品,rtrim(sczl_前工序废) as 前工序废,rtrim(sczl_来料少数) as 来料异常,rtrim(sczl_装版工时) as 装版工时,
|
|
rtrim(sczl_zcfp) as 制程废品,rtrim(sczl_zccp) as 制程次品,rtrim(sczl_前工序废) as 前工序废,rtrim(sczl_来料少数) as 来料异常,rtrim(sczl_装版工时) as 装版工时,
|
|
|
rtrim(sczl_保养工时) as 保养工时,rtrim(sczl_打样工时) as 打样工时,rtrim(sczl_异常停机工时) as 异常停机工时,rtrim(sczl_设备运行工时) as 通电工时,
|
|
rtrim(sczl_保养工时) as 保养工时,rtrim(sczl_打样工时) as 打样工时,rtrim(sczl_异常停机工时) as 异常停机工时,rtrim(sczl_设备运行工时) as 通电工时,
|
|
|
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(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)){
|
|
if (empty($list)){
|
|
|
$this->success('');
|
|
$this->success('');
|
|
@@ -493,10 +501,14 @@ class Facility extends Api
|
|
|
if ($v['yjno']<10){
|
|
if ($v['yjno']<10){
|
|
|
$list[$k]['yjno'] = '0'.$v['yjno'];
|
|
$list[$k]['yjno'] = '0'.$v['yjno'];
|
|
|
}
|
|
}
|
|
|
|
|
+ if (!empty($v['拉料'])){
|
|
|
|
|
+ $list[$k]['拉料姓名'] = \db('人事_基本资料')->where('员工编号',$v['拉料'])->value('rtrim(员工姓名) as 员工姓名');
|
|
|
|
|
+ }else{
|
|
|
|
|
+ $this[$k]['拉料姓名'] = '';
|
|
|
|
|
+ }
|
|
|
$list[$k]['印件及工序'] = $list[$k]['yjno'].'-'.$v['gxmc'];
|
|
$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]['生产时间段'] = substr($v['sj1'],5,5).' '.substr($v['sj1'],11,5).'<-->'.substr($v['sj2'],5,5).' '.substr($v['sj2'],11,5);
|
|
|
$list[$k]['产品名称'] = $name['productName'];
|
|
$list[$k]['产品名称'] = $name['productName'];
|
|
|
- unset($list[$k]['yjno'],$list[$k]['gxmc'],$list[$k]['sj1'],$list[$k]['sj2']);
|
|
|
|
|
}
|
|
}
|
|
|
$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 打样工时,
|
|
@@ -1810,4 +1822,85 @@ class Facility extends Api
|
|
|
$this->success('退还成功');
|
|
$this->success('退还成功');
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 当班产量明细修改
|
|
|
|
|
+ * @return void
|
|
|
|
|
+ * @throws \think\Exception
|
|
|
|
|
+ * @throws \think\db\exception\BindParamException
|
|
|
|
|
+ * @throws \think\exception\PDOException
|
|
|
|
|
+ */
|
|
|
|
|
+ public function chanliangEdit()
|
|
|
|
|
+ {
|
|
|
|
|
+ if (Request::instance()->isPost() === false){
|
|
|
|
|
+ $this->error('请求错误');
|
|
|
|
|
+ }
|
|
|
|
|
+ $param = Request::instance()->post();
|
|
|
|
|
+ if (empty($param['UniqId'])){
|
|
|
|
|
+ $this->error('参数错误');
|
|
|
|
|
+ }
|
|
|
|
|
+ $data = $param;
|
|
|
|
|
+ unset($data['UniqId']);
|
|
|
|
|
+ $sql = \db('设备_产量计酬')
|
|
|
|
|
+ ->where('UniqId',$param['UniqId'])
|
|
|
|
|
+ ->fetchSql(true)
|
|
|
|
|
+ ->update($data);
|
|
|
|
|
+ $res = \db()->query($sql);
|
|
|
|
|
+ if ($res !== false){
|
|
|
|
|
+ $this->success('修改成功');
|
|
|
|
|
+ }else {
|
|
|
|
|
+ $this->error('修改失败');
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //获取当日上报产量详细数据
|
|
|
|
|
+
|
|
|
|
|
+ public function MachineChanliangDetail()
|
|
|
|
|
+ {
|
|
|
|
|
+ if ($this->request->isGet() === false){
|
|
|
|
|
+ $this->error('请求错误');
|
|
|
|
|
+ }
|
|
|
|
|
+ $param = $this->request->param();
|
|
|
|
|
+ if (empty($param['UniqId'])){
|
|
|
|
|
+ $this->error('参数错误');
|
|
|
|
|
+ }
|
|
|
|
|
+ $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_num) as num,rtrim(sczl_sj1) as sj1,
|
|
|
|
|
+ rtrim(sczl_sj2) as sj2,rtrim(sczl_cl) as 产量,rtrim(sczl_bzdh) as bzdh,rtrim(sczl_zcfp) as 制程废品,rtrim(sczl_zccp) as 制程次品,rtrim(sczl_前工序废) as 前工序废,rtrim(sczl_来料少数) as 来料异常,
|
|
|
|
|
+ rtrim(sczl_装版工时) as 装版工时,rtrim(sczl_保养工时) as 保养工时,rtrim(sczl_打样工时) as 打样工时,rtrim(sczl_异常停机工时) as 异常总工时,rtrim(sczl_设备运行工时) as 通电工时,
|
|
|
|
|
+ rtrim(码开始行) as 码开始行,rtrim(码结束行) as 码结束行,rtrim(码包) as 码包,rtrim(主电表) as 主电表,rtrim(辅电表) as 辅电表,rtrim(sczl_ms) as 色度数,
|
|
|
|
|
+ rtrim(sczl_异常工时1) as 异常补时,rtrim(sczl_异常类型1) as 异常类型,sczl_bh1,sczl_bh2,rtrim(sczl_装版工时) as 装版补产工时,rtrim(sczl_打样工时) as 打样补产工时,
|
|
|
|
|
+ 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';
|
|
|
|
|
+ $list = \db('设备_产量计酬')->where('UniqId',$param['UniqId'])->field($field)->find();
|
|
|
|
|
+ if (empty($list)){
|
|
|
|
|
+ $this->success('未找到产量详情信息');
|
|
|
|
|
+ }
|
|
|
|
|
+ $productName = \db('工单_基本资料')->whereIn('Gd_gdbh',$list['工单编号'])->field('rtrim(成品名称) as 成品名称,rtrim(Gd_cpmc) as cpmc')->find();
|
|
|
|
|
+ if (!empty($productName['成品名称'])){
|
|
|
|
|
+ $list['cpmc'] = $productName['成品名称'];
|
|
|
|
|
+ }elseif (empty($productName['成品名称']) && !empty($productName['cpmc'])){
|
|
|
|
|
+ $list['cpmc'] = $productName['cpmc'];
|
|
|
|
|
+ }else{
|
|
|
|
|
+ $list['cpmc'] = '';
|
|
|
|
|
+ }
|
|
|
|
|
+ for ($i=1;$i<11;$i++){
|
|
|
|
|
+ if (isset($list['sczl_bh'.$i])){
|
|
|
|
|
+ $name = \db('人事_基本资料')->where('员工编号',$list['sczl_bh'.$i])->field('rtrim(员工姓名) as name')->find();
|
|
|
|
|
+ if (isset($name['name'])){
|
|
|
|
|
+ $list['组员'.$i] = [
|
|
|
|
|
+ '编号' => $list['sczl_bh'.$i],
|
|
|
|
|
+ '姓名' => $name['name'],
|
|
|
|
|
+ '比例' => ((float)$list['sczl_rate'.$i]*100).'%'
|
|
|
|
|
+ ];
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ unset($list['sczl_bh'.$i],$list['sczl_rate'.$i]);
|
|
|
|
|
+ }
|
|
|
|
|
+ $list['拉料'] = [
|
|
|
|
|
+ '编号' => $list['sczl_bh98'],
|
|
|
|
|
+ '姓名' => \db('人事_基本资料')->where('员工编号',$list['sczl_bh98'])->value('rtrim(员工姓名)')
|
|
|
|
|
+ ];
|
|
|
|
|
+ unset($list['sczl_bh98']);
|
|
|
|
|
+ $this->success('成功',$list);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|