|
|
@@ -1029,4 +1029,48 @@ class Product extends Api
|
|
|
$this->error('新增失败');
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 产品资料删除
|
|
|
+ * @return void
|
|
|
+ * @throws \think\exception\PDOException
|
|
|
+ */
|
|
|
+ public function ProductDel()
|
|
|
+ {
|
|
|
+ if ($this->request->isGet() === false){
|
|
|
+ $this->error('请求错误');
|
|
|
+ }
|
|
|
+ $param = $this->request->param();
|
|
|
+ if (isset($param['UniqId']) === false){
|
|
|
+ $this->error('参数错误');
|
|
|
+ }
|
|
|
+ $WorkOrderId = explode(',',$param['UniqId']);
|
|
|
+ $i = 0;
|
|
|
+ foreach ($WorkOrderId as $key=>$value){
|
|
|
+ //获取产品编号
|
|
|
+ $product = \db('产品_基本资料')
|
|
|
+ ->where('UniqID',$value)
|
|
|
+ ->value('rtrim(产品编号)');
|
|
|
+ //删除工单资料、工艺资料、印件资料
|
|
|
+ \db()->startTrans();
|
|
|
+ try {
|
|
|
+ \db('产品_基本资料')->where('UniqID',$value)->delete();
|
|
|
+ if (!empty(\db('产品_工艺资料')->where('Gy0_cpdh',$product)->find())){
|
|
|
+ \db('产品_工艺资料')->where('Gy0_cpdh',$product)->delete();
|
|
|
+ }
|
|
|
+ if (!empty(\db('产品_印件资料')->where('yj_cpdh',$product)->find())){
|
|
|
+ \db('产品_印件资料')->where('yj_cpdh',$product)->delete();
|
|
|
+ }
|
|
|
+ \db()->commit();
|
|
|
+ }catch (\Exception $e){
|
|
|
+ \db()->rollback();
|
|
|
+ $i++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ($i === 0){
|
|
|
+ $this->success('删除成功');
|
|
|
+ }else{
|
|
|
+ $this->error('删除失败');
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|