|
|
@@ -54,7 +54,7 @@ class Facility extends Api
|
|
|
$this->success('未找到机台生产记录');
|
|
|
}
|
|
|
foreach ($department as $value){
|
|
|
- $machine = \db('设备_基本资料')->where('使用部门',$value)->where('使用部门',$value)->field('rtrim(设备编号) as 设备编号,rtrim(设备名称) as 设备名称')->cache(true)->select();
|
|
|
+ $machine = \db('设备_基本资料')->where('使用部门',$value)->where('sys_sbID','<>','')->where('使用部门',$value)->field('rtrim(设备编号) as 设备编号,rtrim(设备名称) as 设备名称')->cache(true)->select();
|
|
|
foreach ($machine as $k=>$v){
|
|
|
$data[rtrim($value)][$v['设备编号'].'-->'.$v['设备名称']] = [];
|
|
|
foreach ($list as $kk=>$vv){
|
|
|
@@ -221,17 +221,37 @@ class Facility extends Api
|
|
|
}
|
|
|
$machine = $params['machine'];
|
|
|
$data = \db('设备_产量采集')->where('设备编号',$machine)->order('UniqId desc')->find();
|
|
|
+ $endTime = \db('工单_工艺资料')
|
|
|
+ ->where('Gy0_gdbh',$data['工单编号'])
|
|
|
+ ->where('Gy0_sbbh','like','%'.$machine.'%')
|
|
|
+ ->find();
|
|
|
+
|
|
|
$list = [];
|
|
|
- $list['工单编号'] = $data['工单编号'];
|
|
|
- $list['印件号'] = $data['印件号'];
|
|
|
- $list['班组编号'] = $data['班组编号'];
|
|
|
- $name = \db('工单_基本资料')->where('Gd_Gdbh',$data['工单编号'])->value('成品名称');
|
|
|
- $list['产品名称'] = rtrim($name);
|
|
|
- $where['Gy0_gdbh'] = $data['工单编号'];
|
|
|
- $where['Gy0_yjno'] = $data['印件号'];
|
|
|
- $where['Gy0_gxh'] = $data['工序号'];
|
|
|
- $gxmc = \db('工单_工艺资料')->where($where)->value('Gy0_gxmc');
|
|
|
- $list['工序名称'] = rtrim($gxmc);
|
|
|
+ if ($endTime['PD_WG'] === '1900-01-01 00:00:00'){
|
|
|
+ $list['工单编号'] = $data['工单编号'];
|
|
|
+ $list['印件号'] = $data['印件号'];
|
|
|
+ $name = \db('工单_基本资料')->where('Gd_Gdbh',$data['工单编号'])->value('成品名称');
|
|
|
+ $list['产品名称'] = rtrim($name);
|
|
|
+ $where['Gy0_gdbh'] = $data['工单编号'];
|
|
|
+ $where['Gy0_yjno'] = $data['印件号'];
|
|
|
+ $where['Gy0_gxh'] = $data['工序号'];
|
|
|
+ $gxmc = \db('工单_工艺资料')->where($where)->find();
|
|
|
+ if ((int)$gxmc['Gy0_gxh']<10){
|
|
|
+ $gxmc['Gy0_gxh'] = '0'.rtrim($gxmc['Gy0_gxh']);
|
|
|
+ }
|
|
|
+ if ($gxmc['Add_gxmc'] !== ''){
|
|
|
+ $printName = rtrim($gxmc['Gy0_gxh']).'-'.rtrim($gxmc['Gy0_gxmc']).'【'.rtrim($gxmc['Add_gxmc']).'】';
|
|
|
+ }else{
|
|
|
+ $printName = rtrim($gxmc['Gy0_gxh']).'-'.rtrim($gxmc['Gy0_gxmc']);
|
|
|
+ }
|
|
|
+ $list['工序名称'] = $printName;
|
|
|
+ }else{
|
|
|
+ $list['工单编号'] = '';
|
|
|
+ $list['印件号'] = 0;
|
|
|
+ $list['产品名称'] = '';
|
|
|
+ $list['工序名称'] = '';
|
|
|
+ }
|
|
|
+ $list['班组编号'] = rtrim($data['班组编号']);
|
|
|
$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_bh10) as bh10")->find();
|
|
|
@@ -540,24 +560,46 @@ class Facility extends Api
|
|
|
$this->success('成功',$data);
|
|
|
}
|
|
|
|
|
|
- //班组维护
|
|
|
|
|
|
- public function TeamMaintenance()
|
|
|
+ /**
|
|
|
+ * 班组维护->班组添加
|
|
|
+ * @ApiMethod (GET)
|
|
|
+ * @param void
|
|
|
+ * @return void
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
+ * @throws \think\exception\DbException
|
|
|
+ */
|
|
|
+ public function MachineTeamAdd()
|
|
|
{
|
|
|
- if (Request::instance()->isPost() === false){
|
|
|
+ if ($this->request->isGet() === false){
|
|
|
$this->error('请求错误');
|
|
|
}
|
|
|
- $data = Request::instance()->post();
|
|
|
- if (empty($data)){
|
|
|
+ $param = $this->request->param();
|
|
|
+ if (empty($param)){
|
|
|
$this->error('参数错误');
|
|
|
}
|
|
|
- $field = 'rtrim(sczl_bzdh) as sczl_bzdh,rtrim(sczl_bh1) as sczl_bh1,rtrim(sczl_bh2) as sczl_bh2,rtrim(sczl_bh3) as sczl_bh3,rtrim(sczl_bh4) as sczl_bh4,
|
|
|
- rtrim(sczl_bh5) as sczl_bh5,rtrim(sczl_bh6) as sczl_bh6,rtrim(sczl_bh7) as sczl_bh7,rtrim(sczl_bh8) as sczl_bh8,rtrim(sczl_bh9) as sczl_bh9,
|
|
|
- rtrim(sczl_bh10) as sczl_bh10,rtrim(sczl_rate1) as sczl_rate1,rtrim(sczl_rate2) as sczl_rate2,rtrim(sczl_rate3) as sczl_rate3,rtrim(sczl_rate4) as sczl_rate4,
|
|
|
- rtrim(sczl_rate5) as sczl_rate5,rtrim(sczl_rate6) as sczl_rate6,rtrim(sczl_rate7) as sczl_rate7,rtrim(sczl_rate8) as sczl_rate8,
|
|
|
- rtrim(sczl_rate9) as sczl_rate9,rtrim(sczl_rate10) as sczl_rate10';
|
|
|
- $TeamList = \db('设备_班组资料')->where('UniqId',$data['ID'])->field($field)->find();
|
|
|
-
|
|
|
+ $teamDetail = \db('设备_班组资料')
|
|
|
+ ->where('UniqId',$param['UniqId'])
|
|
|
+ ->find();
|
|
|
+ if (empty($teamDetail)){
|
|
|
+ $this->error('数据错误');
|
|
|
+ }
|
|
|
+ $lastId = \db('设备_班组资料')
|
|
|
+ ->order('UniqId desc')
|
|
|
+ ->value('UniqId');
|
|
|
+ if ($lastId<100000){
|
|
|
+ $lastId = 1000000;
|
|
|
+ }
|
|
|
+ $teamDetail['sczl_jtbh'] = $param['machine'].'#';
|
|
|
+ $teamDetail['UniqId'] = $lastId + 1;
|
|
|
+ $teamDetail['sczl_bzdh'] = $param['team'];
|
|
|
+ $res = \db('设备_班组资料')->insert($teamDetail);
|
|
|
+ if ($res !== false){
|
|
|
+ $this->success('成功');
|
|
|
+ }else{
|
|
|
+ $this->error('失败');
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -610,20 +652,6 @@ class Facility extends Api
|
|
|
|
|
|
}
|
|
|
|
|
|
- //制程检验记录->指标检验
|
|
|
-
|
|
|
- public function ProcessInspectionRecords()
|
|
|
- {
|
|
|
- if ($this->request->isGet() === false){
|
|
|
- $this->error('请求错误');
|
|
|
- }
|
|
|
- $param = $this->request->param();
|
|
|
- if (empty($param)){
|
|
|
- $this->error('参数错误');
|
|
|
- }
|
|
|
-// $filed = ''
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 管理人员现场巡检记录->展示
|
|
|
* @ApiMethod (GET)
|
|
|
@@ -719,7 +747,7 @@ class Facility extends Api
|
|
|
'开工时间' => $startTime,
|
|
|
'sys_id' => '',
|
|
|
'sys_rq' => date('Y-m-d H:i:s',time()),
|
|
|
- 'mod_rq' => '',
|
|
|
+ 'mod_rq' => '0000-00-00 00:00:00',
|
|
|
'UniqId' => \db('制程检验_记录')->order('UniqId desc')->field('UniqId')->find()['UniqId']+1
|
|
|
];
|
|
|
$sql = \db('制程检验_记录')->fetchSql(true)->insert($data);
|
|
|
@@ -839,7 +867,6 @@ class Facility extends Api
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 机台印版领用->左侧菜单
|
|
|
* @ApiMethod (GET)
|
|
|
@@ -1172,5 +1199,243 @@ class Facility extends Api
|
|
|
$this->success('成功',$data);
|
|
|
}
|
|
|
|
|
|
- //换型清场
|
|
|
+ /**
|
|
|
+ * 制程检验记录->检验项目
|
|
|
+ * @ApiMethod (GET)
|
|
|
+ * @param void
|
|
|
+ * @return void
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
+ * @throws \think\exception\DbException
|
|
|
+ */
|
|
|
+ public function ProcessInspectionRecordsItem()
|
|
|
+ {
|
|
|
+ if ($this->request->isGet() === false){
|
|
|
+ $this->error('请求错误');
|
|
|
+ }
|
|
|
+ $param = $this->request->param();
|
|
|
+ if (empty($param)){
|
|
|
+ $this->error('参数错误');
|
|
|
+ }
|
|
|
+ $list = \db('制程检验_项目')
|
|
|
+ ->where('工序','like','%'.$param['process'].'%')
|
|
|
+ ->select();
|
|
|
+ if (empty($list)){
|
|
|
+ $this->success('未找到检测项目');
|
|
|
+ }
|
|
|
+ $data = [];
|
|
|
+ foreach ($list as $key=>$value){
|
|
|
+ $data['首件']['指标检验'][$key] = [
|
|
|
+ '检验项目' => rtrim($value['检测项目']),
|
|
|
+ '检测方法' => rtrim($value['检测方法']),
|
|
|
+ '检验频率' => rtrim($value['首件签样要求']),
|
|
|
+ '相关标准' => rtrim($value['技术要求'])
|
|
|
+ ];
|
|
|
+ $data['机台检验']['指标检验'][$key] = [
|
|
|
+ '检验项目' => rtrim($value['检测项目']),
|
|
|
+ '检测方法' => rtrim($value['检测方法']),
|
|
|
+ '检验频率' => rtrim($value['机台自检频率']),
|
|
|
+ '相关标准' => rtrim($value['技术要求'])
|
|
|
+ ];
|
|
|
+ $data['IPQC']['指标检验'][$key] = [
|
|
|
+ '检验项目' => rtrim($value['检测项目']),
|
|
|
+ '检测方法' => rtrim($value['检测方法']),
|
|
|
+ '检验频率' => rtrim($value['IPQC检验频率']),
|
|
|
+ '相关标准' => rtrim($value['技术要求'])
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ $row = \db('制程检验_项目附加')
|
|
|
+ ->where('工序','like','%'.$param['process'].'%')
|
|
|
+ ->select();
|
|
|
+ foreach ($row as $key=>$value){
|
|
|
+ $data['首件']['附加'][$key] = [
|
|
|
+ '缺陷备注' => rtrim($value['缺陷备注']),
|
|
|
+ '编号' => rtrim($value['编号'])
|
|
|
+ ];
|
|
|
+ $data['机台检验']['附加'][$key] = [
|
|
|
+ '缺陷备注' => rtrim($value['缺陷备注']),
|
|
|
+ '编号' => rtrim($value['编号'])
|
|
|
+ ];
|
|
|
+ $data['IPQC']['附加'][$key] = [
|
|
|
+ '缺陷备注' => rtrim($value['缺陷备注']),
|
|
|
+ '编号' => rtrim($value['编号'])
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ $this->success('成功',$data);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 制程检验记录->检测记录添加
|
|
|
+ * @ApiMethod (POST)
|
|
|
+ * @param void
|
|
|
+ * @return void
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
+ * @throws \think\exception\DbException
|
|
|
+ */
|
|
|
+ public function ProcessInspectionRecordsItemAdd()
|
|
|
+ {
|
|
|
+ if (Request::instance()->isPost() === false){
|
|
|
+ $this->error('请求错误');
|
|
|
+ }
|
|
|
+ $param = Request::instance()->post();
|
|
|
+ if (empty($param)){
|
|
|
+ $this->error('参数错误');
|
|
|
+ }
|
|
|
+ $startID = \db('制程检验_记录')->order('UniqId desc')->value('UniqId');
|
|
|
+ if ($startID<100000000){
|
|
|
+ $startID = 100000000;
|
|
|
+ }
|
|
|
+ $process = \db('工单_工艺资料')
|
|
|
+ ->where('Gy0_gdbh',$param[0]['workOrder'])
|
|
|
+ ->where('Gy0_sbbh','like','%'.$param[0]['machine'].'#'.'%')
|
|
|
+ ->field('rtrim(Gy0_gxh) as gxh,rtrim(Gy0_gxmc) as gxmc,rtrim(Add_gxmc) as add_gxmc')
|
|
|
+ ->find();
|
|
|
+ $startTime = \db('设备_产量采集')
|
|
|
+ ->where('设备编号','like','%'.$param[0]['machine'].'#%')
|
|
|
+ ->where('工单编号',$param[0]['workOrder'])
|
|
|
+ ->order('UniqId desc')
|
|
|
+ ->find();
|
|
|
+ if ((int)$process['gxh']<10){
|
|
|
+ $process['gxh'] = '0'.$process['gxh'];
|
|
|
+ }
|
|
|
+ if ($process['add_gxmc'] !== ''){
|
|
|
+ $printName = $process['gxh'].'-'.$process['gxmc'].'【'.$process['add_gxmc'].'】';
|
|
|
+ }else{
|
|
|
+ $printName = $process['gxh'].'-'.$process['gxmc'];
|
|
|
+ }
|
|
|
+ if (empty($process)){
|
|
|
+ $this->success('数据错误');
|
|
|
+ }
|
|
|
+ $data = [];
|
|
|
+ foreach ($param as $key=>$value){
|
|
|
+ $data[$key] = [
|
|
|
+ '类别' => $value['category'],
|
|
|
+ '工单编号' => $value['workOrder'],
|
|
|
+ '印件号' => $value['yjno'],
|
|
|
+ '工序名称' => $printName,
|
|
|
+ '流程单号' => $value['flow'],
|
|
|
+ '设备编号' => $value['machine'],
|
|
|
+ '班组编号' => $startTime['班组编号'],
|
|
|
+ '检验项目' => $value['item'],
|
|
|
+ '相关标准' => $value['standard'],
|
|
|
+ '量测仪器' => $value['instrument'],
|
|
|
+ '检验结果' => $value['result'],
|
|
|
+ '检验备注' => $value['remark'],
|
|
|
+ '提交时间' => date('Y-m-d H:i:s',time()),
|
|
|
+ '开工时间' => rtrim($startTime['开工时间']),
|
|
|
+ 'sys_id' => '',
|
|
|
+ 'sys_rq' => date('Y-m-d H:i:s',time()),
|
|
|
+ 'mod_rq' => '0000-00-00 00:00:00',
|
|
|
+ 'UniqId' => $startID + $key +1
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ $res = \db('制程检验_记录')->insertAll($data);
|
|
|
+ if ($res !== false){
|
|
|
+ $this->success('成功');
|
|
|
+ }else{
|
|
|
+ $this->error('失败');
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 制程检验记录->附加检验记录添加
|
|
|
+ * @ApiMethod (POST)
|
|
|
+ * @param void
|
|
|
+ * @return void
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
+ * @throws \think\exception\DbException
|
|
|
+ */
|
|
|
+ public function AdditionalInspectionRecordAdd()
|
|
|
+ {
|
|
|
+ if (Request::instance()->isPost() === false){
|
|
|
+ $this->error('请求错误');
|
|
|
+ }
|
|
|
+ $param = Request::instance()->post();
|
|
|
+ if (empty($param)){
|
|
|
+ $this->error('参数错误');
|
|
|
+ }
|
|
|
+ $startID = \db('制程检验_记录附加')->order('UniqId desc')->value('UniqId');
|
|
|
+ if ($startID<100000000){
|
|
|
+ $startID = 100000000;
|
|
|
+ }
|
|
|
+ $process = \db('工单_工艺资料')
|
|
|
+ ->where('Gy0_gdbh',$param[0]['workOrder'])
|
|
|
+ ->where('Gy0_sbbh','like','%'.$param[0]['machine'].'#'.'%')
|
|
|
+ ->field('rtrim(Gy0_gxh) as gxh,rtrim(Gy0_gxmc) as gxmc,rtrim(Add_gxmc) as add_gxmc')
|
|
|
+ ->find();
|
|
|
+ $startTime = \db('设备_产量采集')
|
|
|
+ ->where('设备编号','like','%'.$param[0]['machine'].'#%')
|
|
|
+ ->where('工单编号',$param[0]['workOrder'])
|
|
|
+ ->order('UniqId desc')
|
|
|
+ ->find();
|
|
|
+ if ((int)$process['gxh']<10){
|
|
|
+ $process['gxh'] = '0'.$process['gxh'];
|
|
|
+ }
|
|
|
+ if ($process['add_gxmc'] !== ''){
|
|
|
+ $printName = $process['gxh'].'-'.$process['gxmc'].'【'.$process['add_gxmc'].'】';
|
|
|
+ }else{
|
|
|
+ $printName = $process['gxh'].'-'.$process['gxmc'];
|
|
|
+ }
|
|
|
+ if (empty($process)){
|
|
|
+ $this->success('数据错误');
|
|
|
+ }
|
|
|
+ $data = [];
|
|
|
+ foreach ($param as $key=>$value){
|
|
|
+ $data[$key] = [
|
|
|
+ '工单编号' => $value['workOrder'],
|
|
|
+ '印件号' => $value['yjno'],
|
|
|
+ '工序名称' => $printName,
|
|
|
+ '流程单号' => $value['flow'],
|
|
|
+ '设备编号' => $value['machine'],
|
|
|
+ '班组编号' => $startTime['班组编号'],
|
|
|
+ '缺陷备注' => $value['remark'],
|
|
|
+ '提交时间' => date('Y-m-d H:i:s',time()),
|
|
|
+ '开工时间' => rtrim($startTime['开工时间']),
|
|
|
+ 'sys_id' => '',
|
|
|
+ 'sys_rq' => date('Y-m-d H:i:s',time()),
|
|
|
+ 'mod_rq' => '0000-00-00 00:00:00',
|
|
|
+ 'UniqId' => $startID + $key +1
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ $res = \db('制程检验_记录附加')->insertAll($data);
|
|
|
+ if ($res !== false){
|
|
|
+ $this->success('成功');
|
|
|
+ }else{
|
|
|
+ $this->error('失败');
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 客诉记录
|
|
|
+ * @ApiMethod (GET)
|
|
|
+ * @param void
|
|
|
+ * @return void
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
+ * @throws \think\exception\DbException
|
|
|
+ */
|
|
|
+ public function ComplaintRecord()
|
|
|
+ {
|
|
|
+ if ($this->request->isGet() === false){
|
|
|
+ $this->error('请求错误');
|
|
|
+ }
|
|
|
+ $param = $this->request->param();
|
|
|
+ if (isset($param['productCode'])){
|
|
|
+ $where['产品编号'] = $param['productCode'];
|
|
|
+ }
|
|
|
+ $filed = "rtrim(产品编号) as 产品编号,rtrim(产品名称) as 产品名称,rtrim(客诉日期) as 客诉日期,rtrim(客诉单号) as 客诉单号,
|
|
|
+ rtrim(客诉方式) as 客诉方式,rtrim(订单编号) as 订单编号,rtrim(客户编号) as 客户编号,rtrim(客户名称) as 客户名称,
|
|
|
+ rtrim(客诉描述) as 客诉描述,rtrim(缺陷关键字) as 缺陷关键字,rtrim(客诉性质) as 客诉性质,rtrim(扣分) as 扣分,
|
|
|
+ rtrim(主要责任部门) as 主要责任部门,rtrim(次要责任部门) as 次要责任部门";
|
|
|
+ $list = \db('db_客诉记录')
|
|
|
+ ->where($where)
|
|
|
+ ->field($filed)
|
|
|
+ ->select();
|
|
|
+ if (empty($list)){
|
|
|
+ $this->success('未找到该产品客诉记录');
|
|
|
+ }
|
|
|
+ $this->success('成功',$list);
|
|
|
+ }
|
|
|
}
|