|
|
@@ -1688,6 +1688,9 @@ class WorkOrder extends Api
|
|
|
$this->success('成功',$list);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取产品附件列表
|
|
|
+ */
|
|
|
public function getAnnexTable(){
|
|
|
if(!$this->request->isGet()){
|
|
|
$this->error('请求方式错误');
|
|
|
@@ -1707,7 +1710,89 @@ class WorkOrder extends Api
|
|
|
$this->success('成功',$rows)->header(['Content-Type' => 'application/octet-stream']);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取产品附件列表
|
|
|
+ */
|
|
|
+ public function annexAdd(){
|
|
|
+ if(!$this->request->isGet()){
|
|
|
+ $this->error('请求方式错误');
|
|
|
+ }
|
|
|
+ $req = $this->request->param();
|
|
|
+
|
|
|
+ $arr = [
|
|
|
+ 'sys_id',
|
|
|
+ '序号',
|
|
|
+ '附件备注',
|
|
|
+ '附件内容',
|
|
|
+ '附件类型',
|
|
|
+ '适用工序',
|
|
|
+ '关联产品'
|
|
|
+ ];
|
|
|
+ $data = [];
|
|
|
+ foreach ($arr as $key => $value){
|
|
|
+ if (!isset($req[$value])){
|
|
|
+ $this->error('参数错误',$value,$key+1);
|
|
|
+ }
|
|
|
+ $data[$value] = $req[$value];
|
|
|
+ }
|
|
|
+ $data['sys_rq'] = date('Y-m-d H:i:s');
|
|
|
+
|
|
|
+ //查询UniqId
|
|
|
+ $UniqId = db('产品_技术附件')->max('UniqId');
|
|
|
+ $data['UniqId'] = $UniqId < 10000000 ? 10000000 : $UniqId + 1;
|
|
|
+
|
|
|
+ //开启事务
|
|
|
+ db()->startTrans();
|
|
|
+ try{
|
|
|
+ $sql = db('产品_技术附件')->fetchSql(true)->insert($data);
|
|
|
+ $bool = db()->query($sql);
|
|
|
+ // 提交事务
|
|
|
+ db()->commit();
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ // 回滚事务
|
|
|
+ db()->rollback();
|
|
|
+ $this->error($e->getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ if($bool===false) $this->error('失败');
|
|
|
+
|
|
|
+ $this->success('成功');
|
|
|
+ }
|
|
|
|
|
|
+ /**
|
|
|
+ * 修改
|
|
|
+ * @ApiMethod (GET)
|
|
|
+ * @param string 'UniqId'
|
|
|
+ */
|
|
|
+ public function annexDel()
|
|
|
+ {
|
|
|
+ if(!$this->request->isGet()){
|
|
|
+ $this->error('请求方式错误');
|
|
|
+ }
|
|
|
+ $req = $this->request->param();
|
|
|
+
|
|
|
+ if (!(isset($req['UniqId']) && trim($req['UniqId'])!='')){
|
|
|
+ $this->error('参数错误','UniqId',100);
|
|
|
+ }
|
|
|
+
|
|
|
+ //开启事务
|
|
|
+ db()->startTrans();
|
|
|
+ try{
|
|
|
+ $bool = db('产品_技术附件')->where('UniqId',$req['UniqId'])->delete();
|
|
|
+ // 提交事务
|
|
|
+ db()->commit();
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ // 回滚事务
|
|
|
+ db()->rollback();
|
|
|
+ $this->error($e->getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ if($bool===false) $this->error('失败');
|
|
|
+
|
|
|
+ $this->success('成功');
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
//02-产品管理-技术资料附件
|
|
|
public function getExcelInfo()
|
|
|
{
|