|
@@ -31,6 +31,7 @@ class Facility extends Api
|
|
|
}
|
|
}
|
|
|
$data = [];
|
|
$data = [];
|
|
|
$department = Db::table('设备_基本资料')->distinct(true)->column('使用部门');
|
|
$department = Db::table('设备_基本资料')->distinct(true)->column('使用部门');
|
|
|
|
|
+ $date = date('Y-m-d H:i:s',time()-3888000);
|
|
|
if (empty($department)){
|
|
if (empty($department)){
|
|
|
$this->error('未获取到机台数据');
|
|
$this->error('未获取到机台数据');
|
|
|
}
|
|
}
|
|
@@ -39,13 +40,19 @@ class Facility extends Api
|
|
|
$machine = Db::table('设备_基本资料')->where('使用部门',$value)->field('rtrim(设备编号) as 设备编号,rtrim(设备名称) as 设备名称')->select();
|
|
$machine = Db::table('设备_基本资料')->where('使用部门',$value)->field('rtrim(设备编号) as 设备编号,rtrim(设备名称) as 设备名称')->select();
|
|
|
foreach ($machine as $kk=>$vv){
|
|
foreach ($machine as $kk=>$vv){
|
|
|
if ($vv['设备编号'] !== 'ZH01#'){
|
|
if ($vv['设备编号'] !== 'ZH01#'){
|
|
|
- $date = Db::table('设备_产量计酬')->where('sczl_jtbh',$vv['设备编号'])->distinct(true)->cache(60)->order('UniqId desc')->limit(40)->column('sczl_rq');
|
|
|
|
|
|
|
+ $date = Db::table('设备_产量计酬')
|
|
|
|
|
+ ->where('sczl_jtbh',$vv['设备编号'])
|
|
|
|
|
+// ->where('sczl_rq','> time',$date)
|
|
|
|
|
+ ->distinct(true)
|
|
|
|
|
+ ->cache(true)
|
|
|
|
|
+ ->limit(40)
|
|
|
|
|
+ ->order('UniqId desc')
|
|
|
|
|
+ ->column('sczl_rq');
|
|
|
$data[rtrim($value)][$vv['设备编号'].'【'.$vv['设备名称'].'】'] = $date;
|
|
$data[rtrim($value)][$vv['设备编号'].'【'.$vv['设备名称'].'】'] = $date;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
$this->success('成功',$data);
|
|
$this->success('成功',$data);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -668,7 +675,11 @@ class Facility extends Api
|
|
|
$filed = 'rtrim(工单编号) as 工单编号,rtrim(印件号) as 印件号,rtrim(工序名称) as 工序名称,rtrim(流程单号) as 流程单号,
|
|
$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 开工时间';
|
|
rtrim(提交时间) as 提交时间,rtrim(开工时间) as 开工时间';
|
|
|
- $list = Db::table('制程检验_记录')->where($where)->where('UniqId','>',$startId)->field($filed)->select();
|
|
|
|
|
|
|
+ $list = Db::table('制程检验_记录')->where($where)
|
|
|
|
|
+ ->where('UniqId','>',$startId)
|
|
|
|
|
+ ->field($filed)
|
|
|
|
|
+// ->fetchSql(true)
|
|
|
|
|
+ ->select();
|
|
|
if (empty($list)){
|
|
if (empty($list)){
|
|
|
$this->error('未找到该工单当前班次巡检记录');
|
|
$this->error('未找到该工单当前班次巡检记录');
|
|
|
}
|
|
}
|
|
@@ -789,8 +800,16 @@ class Facility extends Api
|
|
|
$this->success('成功',$list);
|
|
$this->success('成功',$list);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- //设备点检->检测记录添加
|
|
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 设备点检->检测记录添加
|
|
|
|
|
+ * @ApiMethod (POST)
|
|
|
|
|
+ * @param void
|
|
|
|
|
+ * @return void
|
|
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
|
|
+ * @throws \think\exception\DbException
|
|
|
|
|
+ */
|
|
|
public function InspectionItemAdd()
|
|
public function InspectionItemAdd()
|
|
|
{
|
|
{
|
|
|
if ($this->request->isPost() === false){
|
|
if ($this->request->isPost() === false){
|
|
@@ -800,6 +819,202 @@ class Facility extends Api
|
|
|
if (empty($param)){
|
|
if (empty($param)){
|
|
|
$this->error('参数错误');
|
|
$this->error('参数错误');
|
|
|
}
|
|
}
|
|
|
|
|
+ $data = [
|
|
|
|
|
+ 'team' => $param['team'],
|
|
|
|
|
+ 'machine' => $param['machine'],
|
|
|
|
|
+ 'unitName' => $param['unitName']
|
|
|
|
|
+ ];
|
|
|
|
|
+ unset($param['team'],$param['machine'],$param['unitName']);
|
|
|
|
|
+ $lastId = Db::table('设备_点检记录')->field('rtrim(Uniqid) as id')->order('Uniqid desc')->find();
|
|
|
|
|
+ $unitCode = Db::table('设备_点检项目')->where('部件名称',$data['unitName'])->field('rtrim(部件编号) as 部件编号')->find();
|
|
|
|
|
+ $row = [];
|
|
|
|
|
+ $param = array_values($param);
|
|
|
|
|
+ foreach ($param as $key=>$value){
|
|
|
|
|
+ $value = explode(';',$value);
|
|
|
|
|
+ $row[$key] = [
|
|
|
|
|
+ '日期' => date('Y-m-d 00:00:00',time()),
|
|
|
|
|
+ '班组编号' => $data['team'],
|
|
|
|
|
+ '点检设备' => $data['machine'],
|
|
|
|
|
+ '部件编号' => $unitCode['部件编号'],
|
|
|
|
|
+ '部件名称' => $data['unitName'],
|
|
|
|
|
+ '检验项目' => $value[0],
|
|
|
|
|
+ '判定标准' => $value[4],
|
|
|
|
|
+ '点检方法' => $value[1],
|
|
|
|
|
+ '点检结果' => $value[2],
|
|
|
|
|
+ '备注说明' => $value[3],
|
|
|
|
|
+ 'Sys_id' =>'',
|
|
|
|
|
+ 'Sys_rq' => date('Y-m-d H:i:s',time()),
|
|
|
|
|
+ 'Mod_rq' => '',
|
|
|
|
|
+ 'Uniqid' => $lastId['id']+$key+1
|
|
|
|
|
+ ];
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ $sql = Db::table('设备_点检记录')->fetchSql(true)->insertAll($row);
|
|
|
|
|
+ $res = Db::query($sql);
|
|
|
|
|
+ if ($res !== false){
|
|
|
|
|
+ $this->success('成功');
|
|
|
|
|
+ }else{
|
|
|
|
|
+ $this->error('失败');
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 机台印版领用->左侧菜单
|
|
|
|
|
+ * @ApiMethod (GET)
|
|
|
|
|
+ * @param void
|
|
|
|
|
+ * @return void
|
|
|
|
|
+ */
|
|
|
|
|
+ public function PrintGetTab()
|
|
|
|
|
+ {
|
|
|
|
|
+ if ($this->request->isGet() === false){
|
|
|
|
|
+ $this->error('请求错误');
|
|
|
|
|
+ }
|
|
|
|
|
+ $param = $this->request->param();
|
|
|
|
|
+ if (empty($param)){
|
|
|
|
|
+ $this->error('参数错误');
|
|
|
|
|
+ }
|
|
|
|
|
+ $productCode = $param['productCode'];
|
|
|
|
|
+ $sql = "SELECT DISTINCT(RTRIM(b.`名称`)) as `印版分类`,RTRIM(b.`编号`) as `编号` FROM `产品_印版资料` as a
|
|
|
|
|
+ JOIN `物料_存货结构` as b ON b.`编号` = SUBSTRING(a.`存货编码`,1,4)
|
|
|
|
|
+ WHERE a.YB_Cpdh = '{$productCode}'";
|
|
|
|
|
+ $res = Db::query($sql);
|
|
|
|
|
+ if (empty($res)){
|
|
|
|
|
+ $this->error('未找到该产品印版资料');
|
|
|
|
|
+ }
|
|
|
|
|
+ $this->success('成功',$res);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 机台印版领用记录->数据详情
|
|
|
|
|
+ * @ApiMethod (GET)
|
|
|
|
|
+ * @param void
|
|
|
|
|
+ * @return void
|
|
|
|
|
+ */
|
|
|
|
|
+ public function PrintDetail()
|
|
|
|
|
+ {
|
|
|
|
|
+ if ($this->request->isGet() === false){
|
|
|
|
|
+ $this->error('请求失败');
|
|
|
|
|
+ }
|
|
|
|
|
+ $param = $this->request->param();
|
|
|
|
|
+ if (empty($param)){
|
|
|
|
|
+ $this->error('参数错误');
|
|
|
|
|
+ }
|
|
|
|
|
+ $productCode = $param['productCode'];
|
|
|
|
|
+ $code = $param['code'].'%';
|
|
|
|
|
+ $workOrder = $param['workOrder'];
|
|
|
|
|
+ $sql = "SELECT
|
|
|
|
|
+ RTRIM(a.`存货编码`) as `存货编码`,
|
|
|
|
|
+ RTRIM(c.`物料名称`) as `存货名称`,
|
|
|
|
|
+ RTRIM(b.`印版名称`) as `印版名称`,
|
|
|
|
|
+ RTRIM(b.`供方批号`) as `供方批号`,
|
|
|
|
|
+ RTRIM(b.`制造日期`) as `制造日期`,
|
|
|
|
|
+ SUM(d.`Yb_印数`) as `印数`,
|
|
|
|
|
+ RTRIM(e.`名称`) as `印版类别`,
|
|
|
|
|
+ SUBSTRING(a.YB_Cpdh,1,4) as `客户编号`,
|
|
|
|
|
+ RTRIM(f.`Gd_客户名称`) as `客户名称`,
|
|
|
|
|
+ RTRIM(a.YB_Cpdh) as `产品编号`,
|
|
|
|
|
+ RTRIM(f.Gd_cpmc) as `产品名称`
|
|
|
|
|
+ FROM `产品_印版资料` as a
|
|
|
|
|
+ LEFT JOIN `产品_印版库` as b ON b.`存货编码` = a.`存货编码`
|
|
|
|
|
+ JOIN `物料_存货编码` as c ON c.`物料代码` = a.`存货编码`
|
|
|
|
|
+ LEFT JOIN `工单_印版领用记录` as d ON d.`Yb_供方批号` = b.`供方批号`
|
|
|
|
|
+ JOIN `物料_存货结构` as e ON e.`编号` = SUBSTRING(a.`存货编码`,1,4)
|
|
|
|
|
+ JOIN `工单_基本资料` as f ON a.YB_Cpdh = f.Gd_cpdh
|
|
|
|
|
+ WHERE a.YB_Cpdh = '{$productCode}'
|
|
|
|
|
+ AND a.`存货编码` LIKE '{$code}'
|
|
|
|
|
+ AND f.Gd_gdbh = '{$workOrder}'
|
|
|
|
|
+ AND b.`报废日期` = '1900-01-01 00:00:00'
|
|
|
|
|
+ GROUP BY b.`供方批号`
|
|
|
|
|
+ ORDER BY a.`存货编码`";
|
|
|
|
|
+ $list = Db::query($sql);
|
|
|
|
|
+ if (empty($list)){
|
|
|
|
|
+ $this->error('未找到印版');
|
|
|
|
|
+ }
|
|
|
|
|
+ $this->success('成功',$list);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //换型清场记录->左侧菜单栏
|
|
|
|
|
+
|
|
|
|
|
+ public function remodelGetTab()
|
|
|
|
|
+ {
|
|
|
|
|
+ if ($this->request->isGet() === false){
|
|
|
|
|
+ $this->error('请求错误');
|
|
|
|
|
+ }
|
|
|
|
|
+ $date = date('Y-m-d 00:00:00',time()-3888000);
|
|
|
|
|
+ $nowTime = date('Y-m-d H:i:s',time());
|
|
|
|
|
+ $list = Db::table('设备_基本资料')->where('使用状态',1)->order('设备编号')->column('设备编号');
|
|
|
|
|
+ if (empty($list)){
|
|
|
|
|
+ $this->error('失败');
|
|
|
|
|
+ }
|
|
|
|
|
+ $sql = "SELECT RTRIM(a.`设备编号`) as `设备编号`,RTRIM(b.`日期`) as `日期`,RTRIM(b.UniqId) as UniqId FROM `设备_基本资料` as a
|
|
|
|
|
+ LEFT JOIN `制程_换型清场` as b ON b.`机台编号` = a.`设备编号`
|
|
|
|
|
+ WHERE b.`日期` > '{$date}' AND b.日期 < '{$nowTime}' ORDER BY b.`日期`";
|
|
|
|
|
+ $res = Db::query($sql);
|
|
|
|
|
+ $data = [];
|
|
|
|
|
+ foreach ($list as $key=>$value){
|
|
|
|
|
+ $i=0;
|
|
|
|
|
+ $data[$value] = [];
|
|
|
|
|
+ foreach ($res as $k=>$v){
|
|
|
|
|
+ $row = [];
|
|
|
|
|
+ if ($value === $v['设备编号']){
|
|
|
|
|
+ $row[$i] = [
|
|
|
|
|
+ '日期' => $v['日期'],
|
|
|
|
|
+ 'id' => $v['UniqId']
|
|
|
|
|
+ ];
|
|
|
|
|
+ $i++;
|
|
|
|
|
+ foreach ($row as $vv){
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ array_push($data[$value],$row);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ $this->success('成功',$data);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 换型清场->详情
|
|
|
|
|
+ * @return void
|
|
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
|
|
+ * @throws \think\exception\DbException
|
|
|
|
|
+ */
|
|
|
|
|
+ public function RemodelDetail()
|
|
|
|
|
+ {
|
|
|
|
|
+ if ($this->request->isGet() === false){
|
|
|
|
|
+ $this->error('请求错误');
|
|
|
|
|
+ }
|
|
|
|
|
+ $param = $this->request->param();
|
|
|
|
|
+ if (empty($param)){
|
|
|
|
|
+ $this->error('参数错误');
|
|
|
|
|
+ }
|
|
|
|
|
+ $field = 'rtrim(日期) as 日期,rtrim(班组) as 班组,rtrim(机台编号) as 机台编号,rtrim(工单编号A) as 工单编号A,rtrim(印件工序A) as 印件工序A,
|
|
|
|
|
+ rtrim(码包号A) as 码包号A,rtrim(工单编号B) as 工单编号B,rtrim(印件工序B) as 印件工序B,rtrim(码包号B) as 码包B,
|
|
|
|
|
+ rtrim(清场项目A) as 项目1,rtrim(清场项目B) as 项目2,rtrim(清场项目C) as 项目3,rtrim(清场项目D) as 项目4,rtrim(清场项目E) as 项目5,
|
|
|
|
|
+ rtrim(机长) as 机长,rtrim(班长) as 班长,rtrim(质量巡查员) as 质量巡查员';
|
|
|
|
|
+ $list = Db::table('制程_换型清场')->where('UniqId',$param['UniqId'])->field($field)->find();
|
|
|
|
|
+ if (empty($list)){
|
|
|
|
|
+ $this->error('未找到该条清场记录');
|
|
|
|
|
+ }
|
|
|
|
|
+ $list['日期'] = date('Y-m-d',strtotime($list['日期']));
|
|
|
|
|
+ $list['印件名称A'] = Db::table('工单_印件资料')->where('Yj_Gdbh',$list['工单编号A'])->field('rtrim(yj_yjmc) as yjmc')->find()['yjmc'];
|
|
|
|
|
+ $list['印件名称B'] = Db::table('工单_印件资料')->where('Yj_Gdbh',$list['工单编号B'])->field('rtrim(yj_yjmc) as yjmc')->find()['yjmc'];
|
|
|
|
|
+ $this->success('成功',$list);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //换型清场->当前清场记录
|
|
|
|
|
+ public function ModelChangeRecord()
|
|
|
|
|
+ {
|
|
|
|
|
+ if ($this->request->isGet() === false){
|
|
|
|
|
+ $this->error('请求错误');
|
|
|
|
|
+ }
|
|
|
|
|
+ $param = $this->request->param();
|
|
|
|
|
+ if (empty($param)){
|
|
|
|
|
+ $this->error('参数错误');
|
|
|
|
|
+ }
|
|
|
|
|
+ $date = date('Y-m-d 00:00:00',time()-3888000);
|
|
|
|
|
+ $nowTime = date('Y-m-d H:i:s',time());
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|