|
@@ -49,14 +49,14 @@ class Manufacture extends Api
|
|
|
rtrim(接单日期) as 接单日期,rtrim(交货日期) as 交货日期,rtrim(订单数量) as 订单数量,rtrim(计量单位) as 计量单位,rtrim(Gd_khmc) as 客户名称,
|
|
rtrim(接单日期) as 接单日期,rtrim(交货日期) as 交货日期,rtrim(订单数量) as 订单数量,rtrim(计量单位) as 计量单位,rtrim(Gd_khmc) as 客户名称,
|
|
|
rtrim(Gd_客户代号) as 客户编号,rtrim(Gd_desc) as 备注,rtrim(客户料号) as 客户料号,rtrim(Sys_id) as 创建用户,rtrim(Sys_rq) as 创建时间,
|
|
rtrim(Gd_客户代号) as 客户编号,rtrim(Gd_desc) as 备注,rtrim(客户料号) as 客户料号,rtrim(Sys_id) as 创建用户,rtrim(Sys_rq) as 创建时间,
|
|
|
rtrim(Mod_rq) as 修改时间,rtrim(Uniqid) as UNIQID,rtrim(投料率) as 投料率,rtrim(销售订单号) as 销售订单号';
|
|
rtrim(Mod_rq) as 修改时间,rtrim(Uniqid) as UNIQID,rtrim(投料率) as 投料率,rtrim(销售订单号) as 销售订单号';
|
|
|
- $list = Db::table('工单_基本资料')->where($where)->field($field)->limit(500)->order('Uniqid desc')->select();
|
|
|
|
|
|
|
+ $list = \db('工单_基本资料')->where($where)->field($field)->limit(500)->order('Uniqid desc')->select();
|
|
|
if (empty($list)){
|
|
if (empty($list)){
|
|
|
$this->error('失败');
|
|
$this->error('失败');
|
|
|
}
|
|
}
|
|
|
foreach ($list as $key=>$value){
|
|
foreach ($list as $key=>$value){
|
|
|
$list[$key]['订单数量'] = rtrim((float)$value['订单数量']);
|
|
$list[$key]['订单数量'] = rtrim((float)$value['订单数量']);
|
|
|
$list[$key]['产品名称'] = $value['产品名称'] != '' ? $value['产品名称']:$value['成品名称'];
|
|
$list[$key]['产品名称'] = $value['产品名称'] != '' ? $value['产品名称']:$value['成品名称'];
|
|
|
- $number = Db::table('工单_工艺资料')->where('Gy0_gdbh',$value['工单编号'])->count();
|
|
|
|
|
|
|
+ $number = \db('工单_工艺资料')->where('Gy0_gdbh',$value['工单编号'])->count();
|
|
|
if ($number === 0){
|
|
if ($number === 0){
|
|
|
$list[$key]['status'] = 0;
|
|
$list[$key]['status'] = 0;
|
|
|
}else{
|
|
}else{
|
|
@@ -91,7 +91,7 @@ class Manufacture extends Api
|
|
|
$filed = 'rtrim(Gy0_gdbh) as 工单编号,rtrim(重点工序) as 重点工序,Gy0_yjno,Gy0_gxh,Gy0_gxmc,Add_gxmc,rtrim(工序备注) as 工序备注,
|
|
$filed = 'rtrim(Gy0_gdbh) as 工单编号,rtrim(重点工序) as 重点工序,Gy0_yjno,Gy0_gxh,Gy0_gxmc,Add_gxmc,rtrim(工序备注) as 工序备注,
|
|
|
rtrim(Gy0_sbbh) as 机组,rtrim(Gy0_小时产能) as 小时产能,rtrim(Gy0_生产工时) as 生产工时,rtrim(Gy0_辅助工时) as 辅助工时,
|
|
rtrim(Gy0_sbbh) as 机组,rtrim(Gy0_小时产能) as 小时产能,rtrim(Gy0_生产工时) as 生产工时,rtrim(Gy0_辅助工时) as 辅助工时,
|
|
|
rtrim(印刷方式) as 印刷方式,rtrim(版距) as 版距,rtrim(Sys_id) as 创建用户,rtrim(Sys_rq) as 创建时间,rtrim(Mod_rq) as 修改时间,rtrim(UniqId) as UNIQID';
|
|
rtrim(印刷方式) as 印刷方式,rtrim(版距) as 版距,rtrim(Sys_id) as 创建用户,rtrim(Sys_rq) as 创建时间,rtrim(Mod_rq) as 修改时间,rtrim(UniqId) as UNIQID';
|
|
|
- $list = Db::table('工单_工艺资料')->where($where)->field($filed)->select();
|
|
|
|
|
|
|
+ $list = \db('工单_工艺资料')->where($where)->field($filed)->select();
|
|
|
if (empty($list)){
|
|
if (empty($list)){
|
|
|
$this->success('',[]);
|
|
$this->success('',[]);
|
|
|
}
|
|
}
|
|
@@ -138,7 +138,7 @@ class Manufacture extends Api
|
|
|
rtrim(yj_zzmc) as 纸张名称,rtrim(yj_tlgg) as 投料规格,rtrim(yj_成品数量) as 成品数量,rtrim(yj_实际投料) as 实际投料,
|
|
rtrim(yj_zzmc) as 纸张名称,rtrim(yj_tlgg) as 投料规格,rtrim(yj_成品数量) as 成品数量,rtrim(yj_实际投料) as 实际投料,
|
|
|
rtrim(yj_Dw) as 投料单位,rtrim(yj_平张投料) as 平张投料,rtrim(yj_ls) as 联数,rtrim(yj_ks) as 开数,rtrim(Sys_id) as 创建用户,
|
|
rtrim(yj_Dw) as 投料单位,rtrim(yj_平张投料) as 平张投料,rtrim(yj_ls) as 联数,rtrim(yj_ks) as 开数,rtrim(Sys_id) as 创建用户,
|
|
|
rtrim(Sys_rq) as 创建时间,rtrim(Mod_rq) as 修改时间,rtrim(Uniqid) as UNIQID';
|
|
rtrim(Sys_rq) as 创建时间,rtrim(Mod_rq) as 修改时间,rtrim(Uniqid) as UNIQID';
|
|
|
- $list = Db::table('工单_印件资料')->where($where)->field($field)->select();
|
|
|
|
|
|
|
+ $list = \db('工单_印件资料')->where($where)->field($field)->select();
|
|
|
if (empty($list)){
|
|
if (empty($list)){
|
|
|
$this->error('失败');
|
|
$this->error('失败');
|
|
|
}
|
|
}
|
|
@@ -311,16 +311,16 @@ class Manufacture extends Api
|
|
|
$this->error('请求错误');
|
|
$this->error('请求错误');
|
|
|
}
|
|
}
|
|
|
$data = [];
|
|
$data = [];
|
|
|
- $department = Db::table('设备_基本资料')->distinct(true)->cache(true)->column('使用部门');
|
|
|
|
|
|
|
+ $department = \db('设备_基本资料')->distinct(true)->cache(true)->column('使用部门');
|
|
|
if (empty($department)){
|
|
if (empty($department)){
|
|
|
$this->error('为获取到机台数据');
|
|
$this->error('为获取到机台数据');
|
|
|
}
|
|
}
|
|
|
foreach ($department as $value){
|
|
foreach ($department as $value){
|
|
|
if (rtrim($value) !== '研发中心'){
|
|
if (rtrim($value) !== '研发中心'){
|
|
|
- $benchClass = Db::table('设备_基本资料')->where('使用部门',$value)->distinct(true)->cache(true)->column('设备编组');
|
|
|
|
|
|
|
+ $benchClass = \db('设备_基本资料')->where('使用部门',$value)->distinct(true)->cache(true)->column('设备编组');
|
|
|
foreach ($benchClass as $v){
|
|
foreach ($benchClass as $v){
|
|
|
if (rtrim($v) !== ''){
|
|
if (rtrim($v) !== ''){
|
|
|
- $machine = Db::table('设备_基本资料')->where('使用部门',$value)->where('设备编组',$v)->field('rtrim(设备编号) as 设备编号,rtrim(设备名称) as 设备名称')->cache(true)->select();
|
|
|
|
|
|
|
+ $machine = \db('设备_基本资料')->where('使用部门',$value)->where('设备编组',$v)->field('rtrim(设备编号) as 设备编号,rtrim(设备名称) as 设备名称')->cache(true)->select();
|
|
|
foreach ($machine as $kk=>$vv){
|
|
foreach ($machine as $kk=>$vv){
|
|
|
$data[rtrim($value)][rtrim($v)][$kk] = $vv['设备编号'].'-->'.$vv['设备名称'];
|
|
$data[rtrim($value)][rtrim($v)][$kk] = $vv['设备编号'].'-->'.$vv['设备名称'];
|
|
|
}
|
|
}
|
|
@@ -351,7 +351,7 @@ class Manufacture extends Api
|
|
|
if (empty($workOrder) || empty($status)){
|
|
if (empty($workOrder) || empty($status)){
|
|
|
$this->error('参数错误');
|
|
$this->error('参数错误');
|
|
|
}
|
|
}
|
|
|
- $sql = Db::table('工单_基本资料')->where('Gd_gdbh',$workOrder)->fetchSql(true)->update(['gd_statu'=>$status]);
|
|
|
|
|
|
|
+ $sql = \db('工单_基本资料')->where('Gd_gdbh',$workOrder)->fetchSql(true)->update(['gd_statu'=>$status]);
|
|
|
$res = Db::query($sql);
|
|
$res = Db::query($sql);
|
|
|
if ($res !== false){
|
|
if ($res !== false){
|
|
|
$this->success('成功');
|
|
$this->success('成功');
|
|
@@ -381,7 +381,7 @@ class Manufacture extends Api
|
|
|
'Gy0_gdbh' => $data['workOrder'],
|
|
'Gy0_gdbh' => $data['workOrder'],
|
|
|
'Gy0_gxh' => $data['processCode']
|
|
'Gy0_gxh' => $data['processCode']
|
|
|
];
|
|
];
|
|
|
- $sql = Db::table('工单_工艺资料')->where($where)->fetchSql(true)->update(['PD_WG'=>date('Y-m-d H:i:s',time())]);
|
|
|
|
|
|
|
+ $sql = \db('工单_工艺资料')->where($where)->fetchSql(true)->update(['PD_WG'=>date('Y-m-d H:i:s',time())]);
|
|
|
$res = Db::query($sql);
|
|
$res = Db::query($sql);
|
|
|
if ($res !== false){
|
|
if ($res !== false){
|
|
|
$this->success('成功');
|
|
$this->success('成功');
|
|
@@ -417,12 +417,12 @@ class Manufacture extends Api
|
|
|
'Gy0_yjno' => $data['printCode'],
|
|
'Gy0_yjno' => $data['printCode'],
|
|
|
'Gy0_gxh' => $data['processCode']
|
|
'Gy0_gxh' => $data['processCode']
|
|
|
];
|
|
];
|
|
|
- $lastTime = Db::table('工单_工艺资料')
|
|
|
|
|
|
|
+ $lastTime = \db('工单_工艺资料')
|
|
|
->where(['Gy0_sbbh'=>$where['Gy0_sbbh'],'Gy0_sj2'=>['<>','1900-01-01 00:00:00'],'Gy0_sj2'=>['<','2099-01-01 00:00:00']])
|
|
->where(['Gy0_sbbh'=>$where['Gy0_sbbh'],'Gy0_sj2'=>['<>','1900-01-01 00:00:00'],'Gy0_sj2'=>['<','2099-01-01 00:00:00']])
|
|
|
->field('rtrim(Gy0_sj2) as sj2')
|
|
->field('rtrim(Gy0_sj2) as sj2')
|
|
|
->order('Gy0_sj2 desc')
|
|
->order('Gy0_sj2 desc')
|
|
|
->find();
|
|
->find();
|
|
|
- $row = Db::table('工单_工艺资料')
|
|
|
|
|
|
|
+ $row = \db('工单_工艺资料')
|
|
|
->where($where)
|
|
->where($where)
|
|
|
->field('rtrim(Gy0_计划接货数) as 计划接货数,rtrim(Gy0_小时产能) as 小时产能,rtrim(Gy0_辅助工时) as 辅助工时')
|
|
->field('rtrim(Gy0_计划接货数) as 计划接货数,rtrim(Gy0_小时产能) as 小时产能,rtrim(Gy0_辅助工时) as 辅助工时')
|
|
|
->find();
|
|
->find();
|
|
@@ -430,7 +430,7 @@ class Manufacture extends Api
|
|
|
$this->error('未找到该工单工艺资料');
|
|
$this->error('未找到该工单工艺资料');
|
|
|
}
|
|
}
|
|
|
$endTime = date('Y-m-d H:i:s',strtotime($lastTime['sj2']) + ((int)round($row['计划接货数']/$row['小时产能'])+(int)$row['辅助工时'])*3600);
|
|
$endTime = date('Y-m-d H:i:s',strtotime($lastTime['sj2']) + ((int)round($row['计划接货数']/$row['小时产能'])+(int)$row['辅助工时'])*3600);
|
|
|
- $sql = Db::table('工单_工艺资料')
|
|
|
|
|
|
|
+ $sql = \db('工单_工艺资料')
|
|
|
->where($where)
|
|
->where($where)
|
|
|
->fetchSql(true)
|
|
->fetchSql(true)
|
|
|
->update(['Gy0_sj1'=>$lastTime['sj2'],'Gy0_sj2'=>$endTime,'Mod_rq'=>date('Y-m-d H:i:s',time())]);
|
|
->update(['Gy0_sj1'=>$lastTime['sj2'],'Gy0_sj2'=>$endTime,'Mod_rq'=>date('Y-m-d H:i:s',time())]);
|
|
@@ -470,18 +470,18 @@ class Manufacture extends Api
|
|
|
'Gy0_gxh' => $data['processCode']
|
|
'Gy0_gxh' => $data['processCode']
|
|
|
];
|
|
];
|
|
|
$machine = $where['Gy0_sbbh'];
|
|
$machine = $where['Gy0_sbbh'];
|
|
|
- $endTime = Db::table('工单_工艺资料')->where($where)->field('rtrim(Gy0_sj2) as sj2')->find()['sj2'];
|
|
|
|
|
|
|
+ $endTime = \db('工单_工艺资料')->where($where)->field('rtrim(Gy0_sj2) as sj2')->find()['sj2'];
|
|
|
if (empty($endTime)){
|
|
if (empty($endTime)){
|
|
|
$this->error('未找到该工序');
|
|
$this->error('未找到该工序');
|
|
|
}
|
|
}
|
|
|
if ($endTime <= '1900-01-01 00:00:00' || $endTime >= '2099-01-01 00:00:00'){
|
|
if ($endTime <= '1900-01-01 00:00:00' || $endTime >= '2099-01-01 00:00:00'){
|
|
|
$this->error('该工单不是制程中工单');
|
|
$this->error('该工单不是制程中工单');
|
|
|
}
|
|
}
|
|
|
- $sql = Db::table('工单_工艺资料')
|
|
|
|
|
|
|
+ $sql = \db('工单_工艺资料')
|
|
|
->where($where)
|
|
->where($where)
|
|
|
->fetchSql(true)
|
|
->fetchSql(true)
|
|
|
->update(['Gy0_sj1'=>'1900-01-01 00:00:00','Gy0_sj2'=>'1900-01-01 00:00:00','Mod_rq'=>date('Y-m-d H:i:s')]);
|
|
->update(['Gy0_sj1'=>'1900-01-01 00:00:00','Gy0_sj2'=>'1900-01-01 00:00:00','Mod_rq'=>date('Y-m-d H:i:s')]);
|
|
|
- $row = Db::table('工单_工艺资料')
|
|
|
|
|
|
|
+ $row = \db('工单_工艺资料')
|
|
|
->where($where)
|
|
->where($where)
|
|
|
->field('rtrim(Gy0_计划接货数) as 计划接货数,rtrim(Gy0_小时产能) as 小时产能,rtrim(Gy0_辅助工时) as 辅助工时')
|
|
->field('rtrim(Gy0_计划接货数) as 计划接货数,rtrim(Gy0_小时产能) as 小时产能,rtrim(Gy0_辅助工时) as 辅助工时')
|
|
|
->find();
|
|
->find();
|
|
@@ -523,7 +523,7 @@ class Manufacture extends Api
|
|
|
];
|
|
];
|
|
|
$workOrder = $where['Gy0_gdbh'];
|
|
$workOrder = $where['Gy0_gdbh'];
|
|
|
$field = 'rtrim(Gy0_yjno) as yjno,rtrim(Gy0_gxh) as gxh,rtrim(Gy0_gxmc) as gxmc,rtrim(Gy0_sbbh) as 设备代号,rtrim(Gy0_计划接货数) as 计划接货数,rtrim(Gy0_ls) as ls,rtrim(PD_WG) as 完工时间,rtrim(UniqId) as UniqId';
|
|
$field = 'rtrim(Gy0_yjno) as yjno,rtrim(Gy0_gxh) as gxh,rtrim(Gy0_gxmc) as gxmc,rtrim(Gy0_sbbh) as 设备代号,rtrim(Gy0_计划接货数) as 计划接货数,rtrim(Gy0_ls) as ls,rtrim(PD_WG) as 完工时间,rtrim(UniqId) as UniqId';
|
|
|
- $list = Db::table('工单_工艺资料')->where($where)->field($field)->order('Gy0_gxh')->select();
|
|
|
|
|
|
|
+ $list = \db('工单_工艺资料')->where($where)->field($field)->order('Gy0_gxh')->select();
|
|
|
if (empty($list)){
|
|
if (empty($list)){
|
|
|
$this->error('未找到该工单工艺资料');
|
|
$this->error('未找到该工单工艺资料');
|
|
|
}
|
|
}
|
|
@@ -579,7 +579,7 @@ class Manufacture extends Api
|
|
|
}else{
|
|
}else{
|
|
|
$endTime = $value['PD_WG'];
|
|
$endTime = $value['PD_WG'];
|
|
|
}
|
|
}
|
|
|
- $sql = Db::table('工单_工艺资料')
|
|
|
|
|
|
|
+ $sql = \db('工单_工艺资料')
|
|
|
->where('UniqId',$value['UniqId'])
|
|
->where('UniqId',$value['UniqId'])
|
|
|
->fetchSql(true)
|
|
->fetchSql(true)
|
|
|
->update(['PD_WG'=>$endTime]);
|
|
->update(['PD_WG'=>$endTime]);
|
|
@@ -609,7 +609,7 @@ class Manufacture extends Api
|
|
|
if ($this->request->isGet() === false){
|
|
if ($this->request->isGet() === false){
|
|
|
$this->error('请求错误');
|
|
$this->error('请求错误');
|
|
|
}
|
|
}
|
|
|
- $list = Db::table('工单_排程班次')->field('rtrim(bcdh) as 班次代号,rtrim(desc_) as desc_,rtrim(stdtime) as stdtime')->select();
|
|
|
|
|
|
|
+ $list = \db('工单_排程班次')->field('rtrim(bcdh) as 班次代号,rtrim(desc_) as desc_,rtrim(stdtime) as stdtime')->select();
|
|
|
if (empty($list)){
|
|
if (empty($list)){
|
|
|
$this->error('未找到班次数据');
|
|
$this->error('未找到班次数据');
|
|
|
}
|
|
}
|
|
@@ -652,7 +652,7 @@ class Manufacture extends Api
|
|
|
rtrim(Gy0_生产工时) as 生产工时,rtrim(Gy0_辅助工时) as 辅助工时,rtrim(Gy0_班次安排) as 班次安排,rtrim(工序备注) as 排单备注,
|
|
rtrim(Gy0_生产工时) as 生产工时,rtrim(Gy0_辅助工时) as 辅助工时,rtrim(Gy0_班次安排) as 班次安排,rtrim(工序备注) as 排单备注,
|
|
|
rtrim(Gy0_最早开工时间) as 最早开工时间,rtrim(Gy0_sj1) as 计划开工时间,rtrim(Gy0_sj2) as 计划完工时间,rtrim(Gy0_yjno) as yjno,
|
|
rtrim(Gy0_最早开工时间) as 最早开工时间,rtrim(Gy0_sj1) as 计划开工时间,rtrim(Gy0_sj2) as 计划完工时间,rtrim(Gy0_yjno) as yjno,
|
|
|
rtrim(Gy0_gxh) as gxh,rtrim(Gy0_gxmc) as gxmc,rtrim(Gy0_ls) as ls,rtrim(UniqId) as UniqId';
|
|
rtrim(Gy0_gxh) as gxh,rtrim(Gy0_gxmc) as gxmc,rtrim(Gy0_ls) as ls,rtrim(UniqId) as UniqId';
|
|
|
- $list = Db::table('工单_工艺资料')->where($where)->field($filed)->cache(true)->select();
|
|
|
|
|
|
|
+ $list = \db('工单_工艺资料')->where($where)->field($filed)->cache(true)->select();
|
|
|
if (empty($list)){
|
|
if (empty($list)){
|
|
|
$this->error('未找到该机台制程中产品');
|
|
$this->error('未找到该机台制程中产品');
|
|
|
}
|
|
}
|
|
@@ -711,7 +711,7 @@ class Manufacture extends Api
|
|
|
'Gy0_sj1' => date('Y-m-d H:i:s',strtotime($value['projectTime'])),
|
|
'Gy0_sj1' => date('Y-m-d H:i:s',strtotime($value['projectTime'])),
|
|
|
'Gy0_sj2' => date('Y-m-d HY-m-d',strtotime(($value['projectTime'])+(ceil($value['ProductionHours'])+ceil($value['AuxiliaryHours']))*3600)),
|
|
'Gy0_sj2' => date('Y-m-d HY-m-d',strtotime(($value['projectTime'])+(ceil($value['ProductionHours'])+ceil($value['AuxiliaryHours']))*3600)),
|
|
|
];
|
|
];
|
|
|
- $sql = Db::table('工单_工艺资料')
|
|
|
|
|
|
|
+ $sql = \db('工单_工艺资料')
|
|
|
->where('UniqId',$value['UniqId'])
|
|
->where('UniqId',$value['UniqId'])
|
|
|
->fetchSql(true)
|
|
->fetchSql(true)
|
|
|
->update($data);
|
|
->update($data);
|
|
@@ -727,8 +727,14 @@ class Manufacture extends Api
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- //机台显示工单
|
|
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 机台工单展示
|
|
|
|
|
+ * @ApiMethod ()
|
|
|
|
|
+ * @return void
|
|
|
|
|
+ * @throws \think\db\exception\BindParamException
|
|
|
|
|
+ * @throws \think\exception\PDOException
|
|
|
|
|
+ */
|
|
|
public function MachineWorkOrderList()
|
|
public function MachineWorkOrderList()
|
|
|
{
|
|
{
|
|
|
if ($this->request->isGet() === false){
|
|
if ($this->request->isGet() === false){
|